diff --git a/src/disasm.c b/src/disasm.c
index a49aa3f828a29f2909b385f6764a35bb87a69598..f4c132f0b8a92fcefc7e638e54e1057de2ae9fcb 100644
--- a/src/disasm.c
+++ b/src/disasm.c
@@ -31,11 +31,11 @@
#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 "> \n", i); Dump_ ## type (val, stream, indent + 1, is_gsub); DUMP ("" #name ">\n"); } while (0)
#define DUMP_VALUE_RECORD(val, frmt) do { DUMP ("\n"); Dump_ValueRecord (val, stream, indent + 1, is_gsub, frmt); DUMP ("\n"); } while (0)
@@ -43,10 +43,7 @@
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
@@ -62,16 +59,16 @@ dump (FILE *stream, int indent, const char *format, ...)
}
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
@@ -79,8 +76,8 @@ Print_Tag (FT_ULong tag, FILE *stream)
{
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));
}
@@ -183,7 +180,7 @@ DEF_DUMP (Coverage)
DUMP_FUINT (&Coverage->cf.cf1, GlyphCount);
for (i = 0; i < Coverage->cf.cf1.GlyphCount; i++)
- DUMP("%#4x \n",
+ DUMP("%#06x \n",
Coverage->cf.cf1.GlyphArray[i], i);
}
else
@@ -192,7 +189,7 @@ DEF_DUMP (Coverage)
DUMP_FUINT (&Coverage->cf.cf2, RangeCount);
for ( i = 0; i < Coverage->cf.cf2.RangeCount; i++ )
- DUMP("%#4x - %#4x \n",
+ DUMP("%#06x - %#06x \n",
Coverage->cf.cf2.RangeRecord[i].Start,
Coverage->cf.cf2.RangeRecord[i].End);
}
@@ -218,7 +215,7 @@ DEF_DUMP (ClassDefinition)
DUMP_FUINT (ClassDefFormat1, StartGlyph );
DUMP_FUINT (ClassDefFormat1, GlyphCount );
for (i = 0; i < ClassDefFormat1->GlyphCount; i++)
- DUMP(" %d ", ClassDefFormat1->ClassValueArray[i],
+ DUMP(" %d ", ClassDefFormat1->ClassValueArray[i],
ClassDefFormat1->StartGlyph+i );
}
else if (ClassDefinition->ClassFormat == 2)
@@ -231,7 +228,7 @@ DEF_DUMP (ClassDefinition)
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)
@@ -281,7 +278,7 @@ Dump_GSUB_Lookup_Single (TTO_SubTable *subtable, FILE *stream, int indent, FT_Bo
DUMP_FINT (&SingleSubst->ssf.ssf2, GlyphCount);
for (i=0; i < SingleSubst->ssf.ssf2.GlyphCount; i++)
- DUMP("%#4x \n", SingleSubst->ssf.ssf2.Substitute[i], i);
+ DUMP("%#06x \n", SingleSubst->ssf.ssf2.Substitute[i], i);
}
}
@@ -293,7 +290,7 @@ DEF_DUMP (Ligature)
DUMP_FUINT (Ligature, ComponentCount);
for (i=0; i < Ligature->ComponentCount - 1; i++)
- DUMP("%#4x\n", Ligature->Component[i]);
+ DUMP("%#06x\n", Ligature->Component[i]);
}
DEF_DUMP (LigatureSet)
@@ -323,7 +320,7 @@ Dump_GSUB_Lookup_Ligature (TTO_SubTable *subtable, FILE *stream, int indent, FT_
DEF_DUMP (ContextSubstFormat1)
{
- DUMP("Not implemented!!!\n");
+ DUMP("\n");
}
DEF_DUMP (ContextSubstFormat2)
@@ -335,7 +332,7 @@ DEF_DUMP (ContextSubstFormat2)
DEF_DUMP (ContextSubstFormat3)
{
- DUMP("Not implemented!!!\n");
+ DUMP("\n");
}
static void
@@ -356,13 +353,13 @@ Dump_GSUB_Lookup_Context (TTO_SubTable *subtable, FILE *stream, int indent, FT_B
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("\n");
}
DEF_DUMP (ChainContextSubstFormat2)
@@ -419,7 +416,7 @@ Dump_GSUB_Lookup_Chain (TTO_SubTable *subtable, FILE *stream, int indent, FT_Boo
Dump_ChainContextSubstFormat3 (&chain->ccsf.ccsf3, stream, indent+2, is_gsub);
break;
default:
- printf("invalid subformat!!!!!\n");
+ fprintf(stderr, "invalid subformat!!!!!\n");
}
}
@@ -664,7 +661,8 @@ DEF_DUMP (Lookup)
}
}
- DUMP("%s\n", lookup_name);
+ DUMP("%s \n", lookup_name, Lookup->LookupType);
+ DUMP("%#06x\n", Lookup->LookupFlag);
for (i=0; i < Lookup->SubTableCount; i++)
{
@@ -688,9 +686,11 @@ DEF_DUMP (LookupList)
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, "\n");
RECURSE (ScriptList, ScriptList, &gsub->ScriptList);
RECURSE (FeatureList, FeatureList, &gsub->FeatureList);
RECURSE (LookupList, LookupList, &gsub->LookupList);
@@ -699,9 +699,11 @@ TT_Dump_GSUB_Table (TTO_GSUB gsub, FILE *stream)
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, "\n");
RECURSE (ScriptList, ScriptList, &gpos->ScriptList);
RECURSE (FeatureList, FeatureList, &gpos->FeatureList);
RECURSE (LookupList, LookupList, &gpos->LookupList);
diff --git a/src/ottest.c b/src/ottest.c
index e9a81c9f118f00e7c05c41d600a56fa2fef106bb..6bf640be013d46501142f7c027e03d8539be3f08 100644
--- a/src/ottest.c
+++ b/src/ottest.c
@@ -28,7 +28,7 @@
#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);
@@ -36,6 +36,7 @@ croak (const char *situation, FT_Error error)
exit (1);
}
+#if 0
enum {
I = 1 << 0,
M = 1 << 1,
@@ -43,17 +44,17 @@ enum {
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,
@@ -81,7 +82,7 @@ maybe_add_feature (TTO_GSUB gsub,
croak ("TT_GSUB_Add_Feature", error);
}
-void
+static void
select_cmap (FT_Face face)
{
FT_UShort i;
@@ -119,7 +120,7 @@ select_cmap (FT_Face face)
}
}
-void
+static void
add_features (TTO_GSUB gsub)
{
FT_Error error;
@@ -144,6 +145,7 @@ add_features (TTO_GSUB gsub)
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
@@ -227,7 +229,9 @@ main (int argc, char **argv)
if ((error = FT_New_Face (library, argv[1], 0, &face)))
croak ("FT_New_Face", error);
- printf("----> GSUB <----\n");
+ printf ("\n");
+ printf ("\n");
+
if (!(error = TT_Load_GSUB_Table (face, &gsub, NULL)))
{
TT_Dump_GSUB_Table (gsub, stdout);
@@ -238,7 +242,6 @@ main (int argc, char **argv)
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);
@@ -249,6 +252,8 @@ main (int argc, char **argv)
else
fprintf (stderr, "TT_Load_GPOS_Table %x\n", error);
+ printf ("\n");
+
#if 0
select_cmap (face);