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)
19 || ! strncmp (ext, ".PFA", 4)
20 || ! strncmp (ext, ".pfa", 4)
21 || ! strncmp (ext, ".PFB", 4)
22 || ! strncmp (ext, ".pfb", 4)));
28 struct dirent **namelist;
29 int n = scandir (".", &namelist, filter, alphasort);
31 FT_Library ft_library;
34 if (FT_Init_FreeType (&ft_library))
37 for (i = 0; i < n; i++)
38 if (! FT_New_Face (ft_library, namelist[i]->d_name, 0, &face))
40 printf ("%s: %s: %s\n", namelist[i]->d_name,
41 face->family_name, face->style_name);
42 if (face->num_charmaps == 0)
44 for (j = 0; j < face->num_charmaps; j++)
46 if (face->charmaps[j]->encoding == ft_encoding_symbol)
48 else if (face->charmaps[j]->encoding == ft_encoding_unicode)
50 else if (face->charmaps[j]->encoding == ft_encoding_latin_1)
52 else if (face->charmaps[j]->encoding == ft_encoding_latin_2)
54 else if (face->charmaps[j]->encoding == ft_encoding_sjis)
56 else if (face->charmaps[j]->encoding == ft_encoding_gb2312)
58 else if (face->charmaps[j]->encoding == ft_encoding_big5)
60 else if (face->charmaps[j]->encoding == ft_encoding_wansung)
62 else if (face->charmaps[j]->encoding == ft_encoding_johab)
64 else if (face->charmaps[j]->encoding == ft_encoding_adobe_standard)
65 printf (" adobe_standard");
66 else if (face->charmaps[j]->encoding == ft_encoding_adobe_expert)
67 printf (" adobe_expert");
68 else if (face->charmaps[j]->encoding == ft_encoding_adobe_custom)
69 printf (" adobe_custom");
70 else if (face->charmaps[j]->encoding == ft_encoding_apple_roman)
71 printf (" apple_roman");
72 else if (face->charmaps[j]->encoding == ft_encoding_none)
75 printf (" 0x%X", (unsigned) face->charmaps[j]->encoding);
76 printf ("(%d-%d),", face->charmaps[j]->platform_id,
77 face->charmaps[j]->encoding_id);