[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 45ed2c6 1/4: [ftsdf] Add main function.
From: |
Werner LEMBERG |
Subject: |
[freetype2-demos] master 45ed2c6 1/4: [ftsdf] Add main function. |
Date: |
Thu, 24 Dec 2020 01:27:21 -0500 (EST) |
branch: master
commit 45ed2c666c3b992e20cc8d3dcb8984d6f74aa9e5
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: Werner Lemberg <wl@gnu.org>
[ftsdf] Add main function.
* src/ftsdf.c (main): New function.
---
ChangeLog | 6 ++++++
src/ftsdf.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 5cdffbe..34a0607 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2020-08-22 Anuj Verma <anujv@iitbhilai.ac.in>
+ [ftsdf] Add main function.
+
+ * src/ftsdf.c (main): New function.
+
+2020-08-22 Anuj Verma <anujv@iitbhilai.ac.in>
+
[ftsdf] Draw SDF to display.
* src/ftsdf.c (clamp, smoothstep, draw): New function.
diff --git a/src/ftsdf.c b/src/ftsdf.c
index 03e64fc..30dc8e7 100644
--- a/src/ftsdf.c
+++ b/src/ftsdf.c
@@ -634,4 +634,68 @@
}
+ int
+ main( int argc,
+ char** argv )
+ {
+ FT_Error err = 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, "800x600x24" );
+ 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( err );
+ }
+
/* END */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 45ed2c6 1/4: [ftsdf] Add main function.,
Werner LEMBERG <=