freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] sdf 8063040 1/9: [ftsdf] New demo program to view SDF


From: Werner LEMBERG
Subject: [freetype2-demos] sdf 8063040 1/9: [ftsdf] New demo program to view SDF glyphs.
Date: Tue, 22 Dec 2020 12:07:35 -0500 (EST)

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

    [ftsdf] New demo program to view SDF glyphs.
    
    * src/ftsdf.c: New file, with first templates.
---
 ChangeLog   |  6 ++++++
 src/ftsdf.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 162fafa..6d13a0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-08-22  Anuj Verma  <anujv@iitbhilai.ac.in>
+
+       [ftsdf] New demo program to view SDF glyphs.
+
+       * src/ftsdf.c: New file, with first templates.
+
 2020-12-01  Priyesh Kumar  <priyeshkkumar@gmail.com>
 
        Synchronize with recent FreeType changes.
diff --git a/src/ftsdf.c b/src/ftsdf.c
new file mode 100644
index 0000000..dd8e688
--- /dev/null
+++ b/src/ftsdf.c
@@ -0,0 +1,72 @@
+
+#include <freetype/ftmodapi.h>
+
+#include "ftcommon.h"
+#include "common.h"
+#include "mlgetopt.h"
+
+#include <stdio.h>
+#include <time.h>
+
+
+  typedef FT_Vector  Vec2;
+  typedef FT_BBox    Box;
+
+
+#define FT_CALL( X )                                                \
+          do                                                        \
+          {                                                         \
+            err = X;                                                \
+            if ( err != FT_Err_Ok )                                 \
+            {                                                       \
+              printf( "FreeType error: %s [LINE: %d, FILE: %s]\n",  \
+                      FT_Error_String( err ), __LINE__, __FILE__ ); \
+              goto Exit;                                            \
+            }                                                       \
+          } while ( 0 )
+
+
+  typedef struct  Status_
+  {
+    FT_Face  face;
+    FT_Int   ptsize;
+    FT_Int   glyph_index;
+    FT_Int   scale;
+    FT_Int   spread;
+    FT_Int   x_offset;
+    FT_Int   y_offset;
+    FT_Bool  nearest_filtering;
+    float    generation_time;
+    FT_Bool  reconstruct;
+    FT_Bool  use_bitmap;
+    FT_Bool  overlaps;
+
+    /* params for reconstruction */
+    float  width;
+    float  edge;
+
+  } Status;
+
+
+  static FTDemo_Handle*   handle  = NULL;
+  static FTDemo_Display*  display = NULL;
+
+  static Status  status =
+  {
+    /* face              */ NULL,
+    /* ptsize            */ 256,
+    /* glyph_index       */ 0,
+    /* scale             */ 1,
+    /* spread            */ 4,
+    /* x_offset          */ 0,
+    /* y_offset          */ 0,
+    /* nearest_filtering */ 0,
+    /* generation_time   */ 0.0f,
+    /* reconstruct       */ 0,
+    /* use_bitmap        */ 0,
+    /* overlaps          */ 0,
+    /* width             */ 0.0f,
+    /* edge              */ 0.2f
+  };
+
+/* END */



reply via email to

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