freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] GSoC-2020-anuj 378ab87 1/5: [ftsdf] Added a new demo p


From: Anuj Verma
Subject: [freetype2-demos] GSoC-2020-anuj 378ab87 1/5: [ftsdf] Added a new demo program to view SDF glyphs.
Date: Sat, 22 Aug 2020 01:37:48 -0400 (EDT)

branch: GSoC-2020-anuj
commit 378ab87787837f7ab82fbd52152311d6ac6dc730
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: Anuj Verma <anujv@iitbhilai.ac.in>

    [ftsdf] Added a new demo program to view SDF glyphs.
    
    `ftsdf' demo program can be used to view the output of the glyphs rendered 
using
    the `sdf' or `bsdf' renderers.
    
    * src/ftsdf.c (*): Added necessary struct, includes, typedefs and global 
variable
      required by the demo program.
---
 src/ftsdf.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/src/ftsdf.c b/src/ftsdf.c
new file mode 100644
index 0000000..d1726b6
--- /dev/null
+++ b/src/ftsdf.c
@@ -0,0 +1,75 @@
+
+#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)\
+    error = X;\
+    if (error != FT_Err_Ok) {\
+        printf("FreeType error: %s [LINE: %d, FILE: %s]\n",\
+          FT_Error_String(error), __LINE__, __FILE__);\
+        goto Exit;\
+    }
+
+  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]