#endif
#define DUMP_FINT(strct,fld) dump (stream, indent, "<" #fld ">%d</" #fld ">\n", (strct)->fld)
#define DUMP_FUINT(strct,fld) dump (stream, indent, "<" #fld ">%u</" #fld ">\n", (strct)->fld)
-#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#4x</" #fld ">\n", (strct)->fld)
-#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#4x</" #fld ">\n", (strct)->fld)
-#define DUMP_USHORT_ARRAY(strct,fld,cnt) Dump_UShort_Array ((strct)->fld, cnt, #fld, stream, indent, is_gsub);
+#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#06x</" #fld ">\n", (strct)->fld)
+#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#06x</" #fld ">\n", (strct)->fld)
+#define DUMP_USHORT_ARRAY(strct,fld,cnt) Dump_UShort_Array ((strct)->fld, cnt, #fld, stream, indent);
-#define DEF_DUMP(type) static void Dump_ ## type (TTO_ ## type *type, FILE *stream, int indent, FT_Bool is_gsub)
+#define DEF_DUMP(type) static void Dump_ ## type (TTO_ ## type *type, FILE *stream, int indent, FT_Bool G_GNUC_UNUSED is_gsub)
#define RECURSE(name, type, val) do { DUMP ("<" #name ">\n"); Dump_ ## type (val, stream, indent + 1, is_gsub); DUMP ("</" #name ">\n"); } while (0)
#define RECURSE_NUM(name, i, type, val) do { DUMP ("<" #name "> <!-- %d -->\n", i); Dump_ ## type (val, stream, indent + 1, is_gsub); DUMP ("</" #name ">\n"); } while (0)
#define DUMP_VALUE_RECORD(val, frmt) do { DUMP ("<ValueRecord>\n"); Dump_ValueRecord (val, stream, indent + 1, is_gsub, frmt); DUMP ("</ValueRecord>\n"); } while (0)
static void
do_indent (FILE *stream, int indent)
{
- int i;
-
- for (i = 0; i < indent * 3; i++)
- fputc (' ', stream);
+ fprintf (stream, "%*s", indent * 3, "");
}
static void
}
static void
-Dump_UShort_Array (FT_UShort *array, int count, const char *name, FILE *stream, int indent, FT_Bool is_gsub)
+Dump_UShort_Array (FT_UShort *array, int count, const char *name, FILE *stream, int indent)
{
int i;
do_indent (stream, indent);
- printf ("<%s>", name);
+ fprintf (stream, "<%s>", name);
for (i = 0; i < count; i++)
- printf ("%d%s", array[i], i == 0 ? "" : " ");
- printf ("</%s>\n", name);
+ fprintf (stream, "%d%s", array[i], i == 0 ? "" : " ");
+ fprintf (stream, "</%s>\n", name);
}
static void
{
fprintf (stream, "%c%c%c%c",
(unsigned char)(tag >> 24),
- (unsigned char)((tag & 0xff0000) >> 16),
- (unsigned char)((tag & 0xff00) >> 8),
+ (unsigned char)((tag >> 16) & 0xff),
+ (unsigned char)((tag >> 8) & 0xff),
(unsigned char)(tag & 0xff));
}
DUMP_FUINT (&Coverage->cf.cf1, GlyphCount);
for (i = 0; i < Coverage->cf.cf1.GlyphCount; i++)
- DUMP("<Glyph>%#4x</Glyph> <!-- %d -->\n",
+ DUMP("<Glyph>%#06x</Glyph> <!-- %d -->\n",
Coverage->cf.cf1.GlyphArray[i], i);
}
else
DUMP_FUINT (&Coverage->cf.cf2, RangeCount);
for ( i = 0; i < Coverage->cf.cf2.RangeCount; i++ )
- DUMP("<Glyph>%#4x - %#4x</Glyph> <!-- %d -->\n",
+ DUMP("<Glyph>%#06x - %#06x</Glyph> <!-- %d -->\n",
Coverage->cf.cf2.RangeRecord[i].Start,
Coverage->cf.cf2.RangeRecord[i].End);
}
DUMP_FUINT (ClassDefFormat1, StartGlyph );
DUMP_FUINT (ClassDefFormat1, GlyphCount );
for (i = 0; i < ClassDefFormat1->GlyphCount; i++)
- DUMP(" <Class>%d</Class> <!-- %#4x -->", ClassDefFormat1->ClassValueArray[i],
+ DUMP(" <Class>%d</Class> <!-- %#06x -->", ClassDefFormat1->ClassValueArray[i],
ClassDefFormat1->StartGlyph+i );
}
else if (ClassDefinition->ClassFormat == 2)
RECURSE_NUM (ClassRangeRecord, i, ClassRangeRecord, &ClassDefFormat2->ClassRangeRecord[i]);
}
else
- printf("invalid class def table!!!\n");
+ fprintf(stderr, "invalid class def table!!!\n");
}
DEF_DUMP (SubstLookupRecord)
DUMP_FINT (&SingleSubst->ssf.ssf2, GlyphCount);
for (i=0; i < SingleSubst->ssf.ssf2.GlyphCount; i++)
- DUMP("<Substitute>%#4x</Substitute> <!-- %d -->\n", SingleSubst->ssf.ssf2.Substitute[i], i);
+ DUMP("<Substitute>%#06x</Substitute> <!-- %d -->\n", SingleSubst->ssf.ssf2.Substitute[i], i);
}
}
DUMP_FUINT (Ligature, ComponentCount);
for (i=0; i < Ligature->ComponentCount - 1; i++)
- DUMP("<Component>%#4x</Component>\n", Ligature->Component[i]);
+ DUMP("<Component>%#06x</Component>\n", Ligature->Component[i]);
}
DEF_DUMP (LigatureSet)
DEF_DUMP (ContextSubstFormat1)
{
- DUMP("Not implemented!!!\n");
+ DUMP("<!-- Not implemented!!! -->\n");
}
DEF_DUMP (ContextSubstFormat2)
DEF_DUMP (ContextSubstFormat3)
{
- DUMP("Not implemented!!!\n");
+ DUMP("<!-- Not implemented!!! -->\n");
}
static void
Dump_ContextSubstFormat3 (&ContextSubst->csf.csf3, stream, indent+2, is_gsub);
break;
default:
- printf("invalid subformat!!!!!\n");
+ fprintf(stderr, "invalid subformat!!!!!\n");
}
}
DEF_DUMP (ChainContextSubstFormat1)
{
- DUMP("Not implemented!!!\n");
+ DUMP("<!-- Not implemented!!! -->\n");
}
DEF_DUMP (ChainContextSubstFormat2)
Dump_ChainContextSubstFormat3 (&chain->ccsf.ccsf3, stream, indent+2, is_gsub);
break;
default:
- printf("invalid subformat!!!!!\n");
+ fprintf(stderr, "invalid subformat!!!!!\n");
}
}
}
}
- DUMP("<LookupType>%s</LookupType>\n", lookup_name);
+ DUMP("<LookupType>%s</LookupType> <!-- %d -->\n", lookup_name, Lookup->LookupType);
+ DUMP("<LookupFlag>%#06x</LookupFlag>\n", Lookup->LookupFlag);
for (i=0; i < Lookup->SubTableCount; i++)
{
void
TT_Dump_GSUB_Table (TTO_GSUB gsub, FILE *stream)
{
- int indent = 0;
+ int indent = 1;
FT_Bool is_gsub = 1;
+ do_indent (stream, indent);
+ fprintf(stream, "<!-- GSUB -->\n");
RECURSE (ScriptList, ScriptList, &gsub->ScriptList);
RECURSE (FeatureList, FeatureList, &gsub->FeatureList);
RECURSE (LookupList, LookupList, &gsub->LookupList);
void
TT_Dump_GPOS_Table (TTO_GPOS gpos, FILE *stream)
{
- int indent = 0;
+ int indent = 1;
FT_Bool is_gsub = 0;
+ do_indent (stream, indent);
+ fprintf(stream, "<!-- GPOS -->\n");
RECURSE (ScriptList, ScriptList, &gpos->ScriptList);
RECURSE (FeatureList, FeatureList, &gpos->FeatureList);
RECURSE (LookupList, LookupList, &gpos->LookupList);
#define N_ELEMENTS(arr) (sizeof(arr)/ sizeof((arr)[0]))
-int
+static int
croak (const char *situation, FT_Error error)
{
fprintf (stderr, "%s: Error %d\n", situation, error);
exit (1);
}
+#if 0
enum {
I = 1 << 0,
M = 1 << 1,
L = 1 << 3
};
-void
+static void
print_tag (FT_ULong tag)
{
fprintf (stderr, "%c%c%c%c",
(unsigned char)(tag >> 24),
- (unsigned char)((tag & 0xff0000) >> 16),
- (unsigned char)((tag & 0xff00) >> 8),
+ (unsigned char)((tag >> 16) & 0xff),
+ (unsigned char)((tag >> 8) & 0xff),
(unsigned char)(tag & 0xff));
}
-void
+static void
maybe_add_feature (TTO_GSUB gsub,
FT_UShort script_index,
FT_ULong tag,
croak ("TT_GSUB_Add_Feature", error);
}
-void
+static void
select_cmap (FT_Face face)
{
FT_UShort i;
}
}
-void
+static void
add_features (TTO_GSUB gsub)
{
FT_Error error;
maybe_add_feature (gsub, script_index, FT_MAKE_TAG ('f', 'i', 'n', 'a'), F);
maybe_add_feature (gsub, script_index, FT_MAKE_TAG ('l', 'i', 'g', 'a'), L);
}
+#endif
#if 0
void
if ((error = FT_New_Face (library, argv[1], 0, &face)))
croak ("FT_New_Face", error);
- printf("----> GSUB <----\n");
+ printf ("<?xml version=\"1.0\"?>\n");
+ printf ("<OpenType>\n");
+
if (!(error = TT_Load_GSUB_Table (face, &gsub, NULL)))
{
TT_Dump_GSUB_Table (gsub, stdout);
else
fprintf (stderr, "TT_Load_GSUB_Table %x\n", error);
- printf("----> GPOS <----\n");
if (!(error = TT_Load_GPOS_Table (face, &gpos, NULL)))
{
TT_Dump_GPOS_Table (gpos, stdout);
else
fprintf (stderr, "TT_Load_GPOS_Table %x\n", error);
+ printf ("</OpenType>\n");
+
#if 0
select_cmap (face);