9 filter (const struct dirent *direntry)
11 int len = strlen (direntry->d_name);
12 const char *ext = direntry->d_name + (len - 4);
15 && (! strncmp (ext, ".ttf", 4)
16 || ! strncmp (ext, ".TTF", 4)
17 || ! strncmp (ext, ".otf", 4)
18 || ! strncmp (ext, ".OTF", 4)));
24 struct dirent **namelist;
25 int n = scandir (".", &namelist, filter, alphasort);
27 FT_Library ft_library;
30 if (FT_Init_FreeType (&ft_library))
33 for (i = 0; i < n; i++)
34 if (! FT_New_Face (ft_library, namelist[i]->d_name, 0, &face))
36 printf ("%s: %s: %s\n", namelist[i]->d_name,
37 face->family_name, face->style_name);
38 if (face->num_charmaps == 0)
40 for (j = 0; j < face->num_charmaps; j++)
42 if (face->charmaps[j]->encoding == ft_encoding_symbol)
44 else if (face->charmaps[j]->encoding == ft_encoding_unicode)
46 else if (face->charmaps[j]->encoding == ft_encoding_latin_1)
48 else if (face->charmaps[j]->encoding == ft_encoding_latin_2)
50 else if (face->charmaps[j]->encoding == ft_encoding_sjis)
52 else if (face->charmaps[j]->encoding == ft_encoding_gb2312)
54 else if (face->charmaps[j]->encoding == ft_encoding_big5)
56 else if (face->charmaps[j]->encoding == ft_encoding_wansung)
58 else if (face->charmaps[j]->encoding == ft_encoding_johab)
60 else if (face->charmaps[j]->encoding == ft_encoding_adobe_standard)
61 printf (" adobe_standard,");
62 else if (face->charmaps[j]->encoding == ft_encoding_adobe_expert)
63 printf (" adobe_expert,");
64 else if (face->charmaps[j]->encoding == ft_encoding_adobe_custom)
65 printf (" adobe_custom,");
66 else if (face->charmaps[j]->encoding == ft_encoding_apple_roman)
67 printf (" apple_roman,");
68 else if (face->charmaps[j]->encoding == ft_encoding_none)
71 printf (" 0x%X,", (unsigned) face->charmaps[j]->encoding);