freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] GSoC-2020-anuj 233ef57: [ftsdf] Added a final mail fun


From: Anuj Verma
Subject: [freetype2-demos] GSoC-2020-anuj 233ef57: [ftsdf] Added a final mail function.
Date: Sat, 22 Aug 2020 01:40:15 -0400 (EDT)

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

    [ftsdf] Added a final mail function.
    
    * src/ftsdf.c (main): Added main entry point of the program.
---
 src/ftsdf.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/src/ftsdf.c b/src/ftsdf.c
index 8cd43c3..9f1f582 100644
--- a/src/ftsdf.c
+++ b/src/ftsdf.c
@@ -560,5 +560,67 @@
     return FT_Err_Ok;
   }
 
+  int
+  main( int     argc,
+        char**  argv )
+  {
+    FT_Error  error = FT_Err_Ok;
+
+
+    if ( argc != 3 )
+    {
+      printf( "Usage: [ptsize] [font file]\n" );
+      exit( -1 );
+    }
+
+    status.ptsize = atoi( argv[1] );
+    handle = FTDemo_New();
+
+    if ( !handle )
+    {
+      printf( "Failed to create FTDemo_Handle\n" );
+      goto Exit;
+    }
+
+    display = FTDemo_Display_New( NULL, "800x600" );
+
+    if ( !display )
+    {
+      printf( "Failed to create FTDemo_Display\n" );
+      goto Exit;
+    }
+
+#ifdef __linux__
+    int flip_y = 1;
+    FT_CALL( FT_Property_Set( handle->library, "sdf", "flip_y", &flip_y ) );
+    FT_CALL( FT_Property_Set( handle->library, "bsdf", "flip_y", &flip_y ) );
+#endif
+
+    grSetTitle( display->surface, "Signed Distance Field Viewer" );
+    event_color_change();
+
+    FT_CALL( FT_New_Face( handle->library, argv[2], 0, &status.face ) );
+    FT_CALL( event_font_update() );
+
+    do 
+    {
+      FTDemo_Display_Clear( display );
+
+      draw();
+
+      write_header();
+
+      grRefreshSurface( display->surface );
+    } while ( !Process_Event() );
+
+  Exit:
+    if ( status.face )
+      FT_Done_Face( status.face );
+    if ( display )
+      FTDemo_Display_Done( display );
+    if ( handle )
+      FTDemo_Done( handle );
+    exit( error );
+  }
 
 /* END */



reply via email to

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