Commit 45ed2c66 authored by Anuj Verma's avatar Anuj Verma Committed by Werner Lemberg

[ftsdf] Add main function.

* src/ftsdf.c (main): New function.
parent 3b0423bc
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.
......
......@@ -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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment