freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] sdf 78c6e34 3/9: [ftsdf] Add function to display some


From: Werner LEMBERG
Subject: [freetype2-demos] sdf 78c6e34 3/9: [ftsdf] Add function to display some information.
Date: Tue, 22 Dec 2020 12:07:36 -0500 (EST)

branch: sdf
commit 78c6e3411e253f5281f8e0b83d1388fa5bc913da
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: Werner Lemberg <wl@gnu.org>

    [ftsdf] Add function to display some information.
    
    * src/ftsdf.c (write_header): New function.
---
 ChangeLog   |  6 ++++++
 src/ftsdf.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 2363018..4cb59f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2020-08-22  Anuj Verma  <anujv@iitbhilai.ac.in>
 
+       [ftsdf] Add function to display some information.
+
+       * src/ftsdf.c (write_header): New function.
+
+2020-08-22  Anuj Verma  <anujv@iitbhilai.ac.in>
+
        [ftsdf] Handle some events.
 
        * src/ftsdf.c (event_font_update, event_color_change, event_help):
diff --git a/src/ftsdf.c b/src/ftsdf.c
index 6095dd8..b842198 100644
--- a/src/ftsdf.c
+++ b/src/ftsdf.c
@@ -200,4 +200,55 @@
   }
 
 
+  /* Print some information to the top left of the screen.   */
+  /* The information contains various properties and values. */
+  static void
+  write_header( void )
+  {
+    static char  header_string[512];
+
+
+    sprintf( header_string,
+             "Glyph Index: %d, Pt Size: %d, Spread: %d, Scale: %d",
+             status.glyph_index,
+             status.ptsize,
+             status.spread,
+             status.scale );
+    grWriteCellString( display->bitmap, 0, 0,
+                       header_string, display->fore_color );
+
+    sprintf( header_string,
+             "Position Offset: %d,%d",
+             status.x_offset,
+             status.y_offset );
+    grWriteCellString( display->bitmap, 0, 1 * HEADER_HEIGHT,
+                       header_string, display->fore_color );
+
+    sprintf( header_string,
+             "SDF Generated in: %.0f ms, From: %s",
+             status.generation_time,
+             status.use_bitmap ? "Bitmap" : "Outline" );
+    grWriteCellString( display->bitmap, 0, 2 * HEADER_HEIGHT,
+                       header_string, display->fore_color );
+
+    sprintf( header_string,
+             "Filtering: %s, View: %s",
+             status.nearest_filtering ? "Nearest" : "Bilinear",
+             status.reconstruct ? "Reconstructing": "Raw" );
+    grWriteCellString( display->bitmap, 0, 3 * HEADER_HEIGHT,
+                       header_string, display->fore_color );
+
+    if ( status.reconstruct )
+    {
+      /* Only print these in reconstruction mode. */
+      sprintf( header_string,
+               "Width: %.2f, Edge: %.2f",
+               status.width,
+               status.edge );
+      grWriteCellString( display->bitmap, 0, 4 * HEADER_HEIGHT,
+                         header_string, display->fore_color );
+    }
+  }
+
+
 /* END */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]