/* * Test program to list the font faces (as determined by freetype) in a * given font file. * * written by Simon Budig , placed in the public domain. * * Compile with: * gcc -Wall `pkg-config --libs --cflags freetype2` \ * -o font-facelist font-facelist.c * * I wrote this to test if freetype detects multiple faces in a .dfont file. * I have yet to find a multi face .dfont file, that gets recognized by * freetype. */ #include #include #include FT_FREETYPE_H int main (int argc, char *argv[]) { FT_Library library; FT_Face face; int error; int i, j, count; error = FT_Init_FreeType (&library); if (error) { printf ("Error initializing Library\n"); exit (1); } for (i = 1; i < argc; i++) { printf ("\nfile: %s\n", argv[i]); j = 0; do { error = FT_New_Face (library, argv[i], j, &face); if (error) { printf (" An Error occurred, skipping...\n"); break; } printf (" %s %s\n", face->family_name, face->style_name); count = face->num_faces; FT_Done_Face (face); j++; } while (j >= 0); } return 0; }