main.c (1074B)
1 #include <stdio.h> 2 3 #include <freetype/freetype.h> 4 #include <ft2build.h> 5 6 7 int 8 main( void ) 9 { 10 FT_Library library; 11 FT_Face face = NULL; 12 13 /* 14 * We assume that `FREETYPE_TESTS_DATA_DIR` was set by `meson test`. 15 * Otherwise we default to `../tests/data`. 16 * 17 * TODO (David): Rewrite this to pass the test directory through the 18 * command-line. 19 */ 20 const char* testdata_dir = getenv( "FREETYPE_TESTS_DATA_DIR" ); 21 char filepath[FILENAME_MAX]; 22 23 24 snprintf( filepath, sizeof( filepath ), "%s/%s", 25 testdata_dir ? testdata_dir : "../tests/data", 26 "As.I.Lay.Dying.ttf" ); 27 28 FT_Init_FreeType( &library ); 29 if ( FT_New_Face( library, filepath, 0, &face ) != 0 ) 30 { 31 fprintf( stderr, "Could not open file: %s\n", filepath ); 32 return 1; 33 } 34 35 for ( FT_ULong i = 59; i < 171; i++ ) 36 { 37 FT_UInt gid = FT_Get_Char_Index( face, i ); 38 FT_Error code = FT_Load_Glyph( face, gid, FT_LOAD_DEFAULT ); 39 40 41 if ( code ) 42 printf( "unknown %d for char %lu, gid %u\n", code, i, gid ); 43 } 44 45 return 0; 46 } 47 48 /* EOF */