-bin_PROGRAMS = otfdump otfdraw otfview
+bin_PROGRAMS = otfdump otfdraw otfview otflist
INCLUDES = `freetype-config --cflags`
CommonLDADD = ${top_builddir}/src/libotf.la
CommonLDFLAGS = -all-static
+otflist_SOURCE = otflist.c
+otflist_LDADD = ${CommonLDADD}
+otflist_LDFLAGS = `freetype-config --libs` ${CommonLDFLAGS}
otfdump_SOURCE = otfdump.c
otfdump_LDADD = ${CommonLDADD}
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <dirent.h>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+int
+filter (const struct dirent *direntry)
+{
+ int len = strlen (direntry->d_name);
+ const char *ext = direntry->d_name + (len - 4);
+
+ return (len >= 5
+ && (! strncmp (ext, ".ttf", 4)
+ || ! strncmp (ext, ".TTF", 4)
+ || ! strncmp (ext, ".otf", 4)
+ || ! strncmp (ext, ".OTF", 4)));
+}
+
+int
+main ()
+{
+ struct dirent **namelist;
+ int n = scandir (".", &namelist, filter, alphasort);
+ int i, j;
+ FT_Library ft_library;
+ FT_Face face;
+
+ if (FT_Init_FreeType (&ft_library))
+ exit (1);
+
+ for (i = 0; i < n; i++)
+ if (! FT_New_Face (ft_library, namelist[i]->d_name, 0, &face))
+ {
+ printf ("%s: %s: %s\n", namelist[i]->d_name,
+ face->family_name, face->style_name);
+ if (face->num_charmaps == 0)
+ continue;
+ for (j = 0; j < face->num_charmaps; j++)
+ {
+ if (face->charmaps[j]->encoding == ft_encoding_symbol)
+ printf (" symbol,");
+ else if (face->charmaps[j]->encoding == ft_encoding_unicode)
+ printf (" unicode,");
+ else if (face->charmaps[j]->encoding == ft_encoding_latin_1)
+ printf (" latin_1,");
+ else if (face->charmaps[j]->encoding == ft_encoding_latin_2)
+ printf (" latin_2,");
+ else if (face->charmaps[j]->encoding == ft_encoding_sjis)
+ printf (" sjis,");
+ else if (face->charmaps[j]->encoding == ft_encoding_gb2312)
+ printf (" gb2312,");
+ else if (face->charmaps[j]->encoding == ft_encoding_big5)
+ printf (" big5,");
+ else if (face->charmaps[j]->encoding == ft_encoding_wansung)
+ printf (" wansung,");
+ else if (face->charmaps[j]->encoding == ft_encoding_johab)
+ printf (" johab,");
+ else if (face->charmaps[j]->encoding == ft_encoding_adobe_standard)
+ printf (" adobe_standard,");
+ else if (face->charmaps[j]->encoding == ft_encoding_adobe_expert)
+ printf (" adobe_expert,");
+ else if (face->charmaps[j]->encoding == ft_encoding_adobe_custom)
+ printf (" adobe_custom,");
+ else if (face->charmaps[j]->encoding == ft_encoding_apple_roman)
+ printf (" apple_roman,");
+ else if (face->charmaps[j]->encoding == ft_encoding_none)
+ printf (" none,");
+ else
+ printf (" 0x%X,", (unsigned) face->charmaps[j]->encoding);
+ }
+ printf ("\n");
+ }
+ exit (0);
+}
OTF_Glyph *g;
int unicode_seq[256];
int n_codes = 0;
+ int pixel_size = PIXEL_SIZE;
+
/* Window structure.
+-------------------------+
exit (1);
}
+ {
+ char *p = getenv ("PIXEL_SIZE");
+ int n;
+
+ if (p && sscanf (p, "%d", &n) == 1)
+ pixel_size = n;
+ }
+
err = FT_Init_FreeType (&library);
if (err)
quit ("FT_Init_FreeType");
quit ("FT_New_Face: unknown file format");
else if (err)
quit ("FT_New_Face: unknown error");
- err = FT_Set_Pixel_Sizes (face, 0, PIXEL_SIZE);
+ err = FT_Set_Pixel_Sizes (face, 0, pixel_size);
if (err)
quit ("FT_Set_Char_Size");
for (i = 0; i < 0x10000; i++)
{
+ if (i >= 0xD800 && i < 0xE000)
+ continue;
gstring.glyphs[i & 0xFF].c = i;
if ((i & 0xFF) == 0xFF)
{
for (j = 0; j < 0x100; j++)
{
utog[(i & 0xFF00) + j] = gstring.glyphs[j].glyph_id;
- if (gstring.glyphs[j].glyph_id > 0)
+ if (gstring.glyphs[j].glyph_id > 0
+ && gstring.glyphs[j].glyph_id < 0x10000)
bitmap[gstring.glyphs[j].glyph_id].unicode = (i & 0xFF00) + j;
}
}
{
case 1: case 2:
if (g->f.f1.format & OTF_XPlacement)
- xoff = PIXEL_SIZE * ((double) (g->f.f1.value->XPlacement)
+ xoff = pixel_size * ((double) (g->f.f1.value->XPlacement)
* 100 / otf->head->unitsPerEm);
if (g->f.f1.format & OTF_YPlacement)
- yoff = PIXEL_SIZE * ((double) (g->f.f1.value->YPlacement)
+ yoff = pixel_size * ((double) (g->f.f1.value->YPlacement)
* 100 / otf->head->unitsPerEm);
break;
case 4:
- xoff = (PIXEL_SIZE
+ xoff = (pixel_size
* ((double) (g->f.f4.base_anchor->XCoordinate
- g->f.f4.mark_anchor->XCoordinate)
* 100 / otf->head->unitsPerEm));
- yoff = (PIXEL_SIZE
+ yoff = (pixel_size
* ((double) (g->f.f4.base_anchor->YCoordinate
- g->f.f4.mark_anchor->YCoordinate)
* 100 / otf->head->unitsPerEm));
int j;
int orig_used;
- printf ("GSUB 6-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
+ // printf ("GSUB 6-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
class = get_class_def (&context2->InputClassDef, g->glyph_id);
set = context2->ChainClassSet + class;
for (j = 0; j < set->ChainClassRuleCnt; j++)
OTF_GPOS_Pair2 *pair2 = &subtable->u.pair2;
unsigned class1, class2;
- printf ("GPOS 2-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
+ // printf ("GPOS 2-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
gidx++;
class1 = get_class_def (&pair2->ClassDef1, g->glyph_id);
class2 = get_class_def (&pair2->ClassDef2, g[1].glyph_id);
if (coverage_idx_base < 0)
continue;
- printf ("GPOS 4-1: c:0x%x g:0x%x\n", g->c, g->glyph_id);
+ // printf ("GPOS 4-1: c:0x%x g:0x%x\n", g->c, g->glyph_id);
mark_record = mark_base1->MarkArray.MarkRecord + coverage_idx;
base_record
= mark_base1->BaseArray.AnchorRecord + coverage_idx_base;
if (coverage_idx_base < 0)
continue;
- printf ("GPOS 6-1: c:0x%x g:0x%x\n", g->c, g->glyph_id);
+ // printf ("GPOS 6-1: c:0x%x g:0x%x\n", g->c, g->glyph_id);
mark1_record = mark_mark1->Mark1Array.MarkRecord + coverage_idx;
mark2_record
= mark_mark1->Mark2Array.AnchorRecord + coverage_idx_base;
int j;
int orig_used;
- printf ("GPOS 8-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
+ // printf ("GPOS 8-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
class = get_class_def (&context2->InputClassDef, g->glyph_id);
set = context2->ChainClassSet + class;
for (j = 0; j < set->ChainClassRuleCnt; j++)
(1-10) "GPOS" table
(1-11) Structure for OTF
- (2) APIs for reading OTF
+ (2) API for reading OTF
(2-1) OTF_open()
(2-2) OTF_close()
(2-3) OTF_get_table()
- (5) APIs miscellaneous
+ (5) API miscellaneous
*/
\f
/* (0) Stream handler
}
\f
-/*** (2) APIs for reading OTF */
+/*** (2) API for reading OTF */
/*** (2-1) OTF_open() */
}
\f
-/*** (5) APIs miscellaneous ***/
+/*** (5) API miscellaneous ***/
OTF_Tag
OTF_tag (char *name)