2021-06-15 23:12:57 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <freetype/freetype.h>
|
|
|
|
#include <ft2build.h>
|
|
|
|
|
2021-07-15 19:26:20 +02:00
|
|
|
|
2021-06-15 23:12:57 +02:00
|
|
|
int
|
|
|
|
main( void )
|
|
|
|
{
|
2021-07-15 19:26:20 +02:00
|
|
|
FT_Library library;
|
|
|
|
FT_Face face = NULL;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We assume that `FREETYPE_TESTS_DATA_DIR` was set by `meson test`.
|
|
|
|
* Otherwise we default to `../tests/data`.
|
|
|
|
*
|
|
|
|
* TODO (David): Rewrite this to pass the test directory through the
|
|
|
|
* command-line.
|
|
|
|
*/
|
|
|
|
const char* testdata_dir = getenv( "FREETYPE_TESTS_DATA_DIR" );
|
2021-10-20 17:27:03 +02:00
|
|
|
char filepath[FILENAME_MAX];
|
2021-07-15 19:26:20 +02:00
|
|
|
|
2021-06-15 23:12:57 +02:00
|
|
|
|
2021-07-15 19:26:20 +02:00
|
|
|
snprintf( filepath, sizeof( filepath ), "%s/%s",
|
|
|
|
testdata_dir ? testdata_dir : "../tests/data",
|
|
|
|
"As.I.Lay.Dying.ttf" );
|
2021-06-15 23:12:57 +02:00
|
|
|
|
|
|
|
FT_Init_FreeType( &library );
|
2021-07-15 19:02:57 +02:00
|
|
|
if ( FT_New_Face( library, filepath, 0, &face ) != 0 )
|
2021-06-15 23:12:57 +02:00
|
|
|
{
|
|
|
|
fprintf( stderr, "Could not open file: %s\n", filepath );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2021-07-15 19:26:20 +02:00
|
|
|
for ( FT_ULong i = 59; i < 171; i++ )
|
2021-06-15 23:12:57 +02:00
|
|
|
{
|
2021-07-15 19:26:20 +02:00
|
|
|
FT_UInt gid = FT_Get_Char_Index( face, i );
|
|
|
|
FT_Error code = FT_Load_Glyph( face, gid, FT_LOAD_DEFAULT );
|
|
|
|
|
|
|
|
|
2021-06-15 23:12:57 +02:00
|
|
|
if ( code )
|
|
|
|
printf( "unknown %d for char %lu, gid %u\n", code, i, gid );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2021-07-15 19:26:20 +02:00
|
|
|
|
|
|
|
/* EOF */
|