8 extern int EF_ALIGNMENT;
9 extern int EF_PROTECT_BELOW;
10 extern int EF_PROTECT_FREE;
14 char *indent_spaces[] =
15 { "", " ", " ", " ", " ", " ", " ",
19 #define IPRINT printf("\n%s", indent_spaces[indent]), printf
22 dump_tag (OTF_Tag tag)
26 putchar ((tag >> 16) & 0xFF);
27 putchar ((tag >> 8) & 0xFF);
29 printf ("\" #x%04X)", tag);
35 dump_offset_table (int indent, OTF_OffsetTable *table)
37 IPRINT ("(OffsetTable");
39 IPRINT ("(sfnt-version %d.%d)",
40 table->sfnt_version.high, table->sfnt_version.low);
41 IPRINT ("(numTables %d)", table->numTables);
42 IPRINT ("(searchRange %d)", table->searchRange);
43 IPRINT ("(enterSelector %d)", table->enterSelector);
44 IPRINT ("(rangeShift %d))", table->rangeShift);
48 dump_table_directory (int indent, OTF_TableDirectory *table, int idx)
50 IPRINT ("(Table %d ", idx);
51 dump_tag (table->tag);
53 IPRINT ("(checkSum %08X) (offset #x%08X) (length: #x%08X))",
54 table->checkSum, table->offset, table->length);
61 dump_head_table (int indent, OTF_head *head)
65 IPRINT ("(TableVersionNumber %d.%d)",
66 head->TableVersionNumber.high, head->TableVersionNumber.low);
67 IPRINT ("(fontRevision %d.%d)",
68 head->fontRevision.high, head->fontRevision.low);
69 IPRINT ("(checkSumAdjustment #x%04X)", head->checkSumAdjustment);
70 IPRINT ("(magicNumber #x%04X)", head->magicNumber);
71 IPRINT ("(flags #x%04X)", head->flags);
72 IPRINT ("(unitsPerEm %d)", head->unitsPerEm);
80 dump_glyph_ids (OTF_GlyphID *ids, unsigned num)
84 printf (" #x%04X", *ids);
90 dump_coverage (int indent, char *title, OTF_Coverage *coverage)
94 IPRINT ("(%sCoverage (CoverageFormat %d)",
95 (title ? title : ""), coverage->CoverageFormat);
97 if (coverage->CoverageFormat == 1)
99 IPRINT ("(GlyphCount %d)", coverage->Count);
100 IPRINT ("(GlyphArray");
101 dump_glyph_ids (coverage->table.GlyphArray, coverage->Count);
106 IPRINT ("(RangeCount %d)", coverage->Count);
108 for (i = 0; i < coverage->Count; i++)
110 IPRINT ("(Range (%d) (Start #x%04X) (End #x%04X)", i,
111 coverage->table.RangeRecord[i].Start,
112 coverage->table.RangeRecord[i].End);
114 IPRINT ("(StartCoverageIndex %d))",
115 coverage->table.RangeRecord[i].StartCoverageIndex);
123 dump_coverage_list (int indent, char *title,
124 OTF_Coverage *coverage, unsigned num)
128 IPRINT ("(%s %d)", title, num);
129 for (i = 0; i < num; i++)
130 dump_coverage (indent, NULL, coverage + i);
135 dump_language_system (int indent, int index, OTF_Tag tag, OTF_Offset offset,
136 OTF_LangSys *langsys)
140 IPRINT ("(LangSys ");
142 printf ("(%d) ", index);
146 printf ("DefaultLangSys");
147 printf (" (Offset #x%04X)", offset);
149 IPRINT ("(LookupOrder #x%04X)", langsys->LookupOrder);
150 IPRINT ("(ReqFeatureIndex %d)", langsys->ReqFeatureIndex);
151 IPRINT ("(FeatureCount %d)", langsys->FeatureCount);
152 if (langsys->FeatureCount)
154 IPRINT ("(FeatureIndex");
155 for (i = 0; i < langsys->FeatureCount; i++)
156 printf (" %d", langsys->FeatureIndex[i]);
163 dump_script_list (int indent, OTF_ScriptList *list)
167 IPRINT ("(ScriptList (count %d)", list->ScriptCount);
169 for (i = 0; i < list->ScriptCount; i++)
171 OTF_Script *script = list->Script + i;
173 IPRINT ("(Script (%d) ", i);
174 dump_tag (list->Script[i].ScriptTag);
175 printf (" (Offset #x%04X)", list->Script[i].offset);
177 IPRINT ("(DefaultLangSysOffset #x%04X)",
178 script->DefaultLangSysOffset);
179 if (script->DefaultLangSysOffset)
180 dump_language_system (indent, -1, 0,
181 script->DefaultLangSysOffset,
182 &script->DefaultLangSys);
183 IPRINT ("(LangSysCount %d)", script->LangSysCount);
184 for (j = 0; j < script->LangSysCount; j++)
185 dump_language_system (indent, j,
186 script->LangSysRecord[j].LangSysTag,
187 script->LangSysRecord[j].LangSys,
188 script->LangSys + j);
196 dump_feature_list (int indent, OTF_FeatureList *list)
200 IPRINT ("(FeatureList (count %d)", list->FeatureCount);
202 for (i = 0; i < list->FeatureCount; i++)
204 OTF_Feature *feature = list->Feature + i;
206 IPRINT ("(Feature (%d) ", i);
207 dump_tag (list->Feature[i].FeatureTag);
208 printf (" (Offset #x%04X)", list->Feature[i].offset);
209 printf (" (LookupCount %d)", feature->LookupCount);
210 if (feature->LookupCount)
213 IPRINT ("(LookupListIndex");
214 for (j = 0; j < feature->LookupCount; j++)
215 printf (" %d", feature->LookupListIndex[j]);
225 dump_class_def (int indent, char *title, OTF_ClassDef *class)
227 IPRINT ("(%s (offset #x%04X) (ClassFormat %d)",
228 (title ? title : "ClassDef"),
229 class->offset, class->ClassFormat);
231 if (class->ClassFormat == 1)
233 IPRINT ("(StartGlyph #x%04X)", class->f.f1.StartGlyph);
234 IPRINT ("(GlyphCount %d)", class->f.f1.GlyphCount);
235 IPRINT ("(ClassValueArray");
236 dump_glyph_ids ((OTF_GlyphID *) class->f.f1.ClassValueArray,
237 class->f.f1.GlyphCount);
240 else if (class->ClassFormat == 2)
244 IPRINT ("(ClassRangeCount %d)", class->f.f2.ClassRangeCount);
245 IPRINT ("(ClassRangeRecord");
247 for (i = 0; i < class->f.f2.ClassRangeCount; i++)
248 IPRINT ("((Start #x%04X) (End #x%04X) (class %d))",
249 class->f.f2.ClassRangeRecord[i].Start,
250 class->f.f2.ClassRangeRecord[i].End,
251 class->f.f2.ClassRangeRecord[i].Class);
255 printf ("UknownClassFormat");
260 dump_device_table (int indent, char *title, OTF_DeviceTable *table)
266 IPRINT ("(%s (offset #x%04X)", title, table->offset);
268 IPRINT ("(StartSize %d) (EndSize %d) (DeltaFormat %d)",
269 table->StartSize, table->EndSize, table->DeltaFormat);
270 IPRINT ("(DeltaValue");
271 for (i = 0; i < table->EndSize - table->StartSize + 1; i++)
272 printf (" %d", table->DeltaValue[i]);
279 dump_value_record (int indent, char *title, OTF_ValueRecord *rec)
281 IPRINT ("(%s %d %d %d %d", title,
282 rec->XPlacement, rec->YPlacement, rec->XAdvance, rec->YAdvance);
284 if (rec->XPlaDevice.offset)
285 dump_device_table (indent, "XPlaDevice", &rec->XPlaDevice);
286 if (rec->YPlaDevice.offset)
287 dump_device_table (indent, "YPlaDevice", &rec->YPlaDevice);
288 if (rec->XAdvDevice.offset)
289 dump_device_table (indent, "XAdvDevice", &rec->XAdvDevice);
290 if (rec->YAdvDevice.offset)
291 dump_device_table (indent, "YAdvDevice", &rec->YAdvDevice);
297 dump_sequence_list (int indent, OTF_Sequence *sequence, unsigned num)
300 IPRINT ("(SequenceCount %d)", num);
302 for (i = 0; i < num; i++)
304 IPRINT ("(Sequence (%d) (offset #x%04X)",
305 i, sequence[i].offset);
307 IPRINT ("(GlyphCount %d)", sequence[i].GlyphCount);
308 IPRINT ("(Substitute");
309 dump_glyph_ids (sequence[i].Substitute, sequence[i].GlyphCount);
316 dump_ligature_set_list (int indent, OTF_LigatureSet *ligset, unsigned num)
320 IPRINT ("(LigSetCount %d)", num);
321 for (i = 0; i < num; i++)
323 IPRINT ("(LigatureSet (%d) (offset #x%04X) (count %d)",
324 i, ligset[i].offset, ligset[i].LigatureCount);
326 for (j = 0; j < ligset[i].LigatureCount; j++)
328 IPRINT ("(Ligature (%d) (offset #x%04X)",
329 j, ligset[i].Ligature[j].offset);
331 IPRINT ("(LigGlyph #x%04X)",
332 ligset[i].Ligature[j].LigGlyph);
333 IPRINT ("(ComCount %d)",
334 ligset[i].Ligature[j].CompCount);
335 IPRINT ("(Component");
336 dump_glyph_ids (ligset[i].Ligature[j].Component,
337 ligset[i].Ligature[j].CompCount - 1);
347 dump_class1_record_list (int indent,
348 unsigned Class1Count, unsigned Class2Count,
349 OTF_Class1Record *rec)
353 for (i = 0; i < Class1Count; i++)
355 IPRINT ("(Class1Record (%d)", i);
357 for (j = 0; j < Class2Count; j++)
359 IPRINT ("(Class2Record (%d)", j);
361 dump_value_record (indent, "Value1", &rec[i].Class2Record[j].Value1);
362 dump_value_record (indent, "Value2", &rec[i].Class2Record[j].Value2);
372 dump_anchor (int indent, OTF_Anchor *anchor)
374 IPRINT ("(Anchor (offset #x%04X) (AnchorFormat %d)",
375 anchor->offset, anchor->AnchorFormat);
377 IPRINT ("(XCoordinate %d) (YCoordinate %d)",
378 anchor->XCoordinate, anchor->YCoordinate);
379 if (anchor->AnchorFormat == 1)
381 else if (anchor->AnchorFormat == 2)
382 IPRINT ("(AnchorPoint %d)", anchor->f.f1.AnchorPoint);
385 dump_device_table (indent, "XDeviceTable", &anchor->f.f2.XDeviceTable);
386 dump_device_table (indent, "YDeviceTable", &anchor->f.f2.YDeviceTable);
392 dump_mark_array (int indent, OTF_MarkArray *array)
396 IPRINT ("(MarkArray (MarkCount %d)", array->MarkCount);
398 for (i = 0; i < array->MarkCount; i++)
400 IPRINT ("(MarkRecord (%d) (Class %d)", i, array->MarkRecord[i].Class);
401 dump_anchor (indent + 1, &array->MarkRecord[i].MarkAnchor);
408 dump_base_array (int indent, unsigned ClassCount, OTF_BaseArray *array)
412 IPRINT ("(BaseArray (BaseCount %d)", array->BaseCount);
414 for (i = 0; i < array->BaseCount; i++)
416 IPRINT ("(BaseRecord (%d) ", i);
417 for (j = 0; j < ClassCount; j++)
418 dump_anchor (indent + 1, array->BaseRecord[i].BaseAnchor + j);
426 dump_subst_lookup_record_list (int indent,
427 OTF_SubstLookupRecord *rec, unsigned num)
431 IPRINT ("(SubstCount %d)", num);
432 for (i = 0; i < num; i++)
434 IPRINT ("(SubstLookupRecord (%d)", i);
436 IPRINT ("(SequenceIndex %d)", rec[i].SequenceIndex);
437 IPRINT ("(LookupListIndex %d))", rec[i].LookupListIndex);
443 static void dump_lookup_subtable_gsub (int indent, int index, unsigned type,
444 OTF_LookupSubTable *subtable);
445 static void dump_lookup_subtable_gpos (int indent, int index, unsigned type,
446 OTF_LookupSubTable *subtable);
450 dump_lookup_list (int indent, OTF_LookupList *list, int gsub)
454 IPRINT ("(LookupList (count %d)", list->LookupCount);
456 for (i = 0; i < list->LookupCount; i++)
458 OTF_Lookup *lookup = list->Lookup + i;
460 IPRINT ("(Lookup (%d) (Offset #x%04X)",
462 printf (" (Type %d) (Flag #x%04X) (SubTableCount %d)",
463 lookup->LookupType, lookup->LookupFlag, lookup->SubTableCount);
465 for (j = 0; j < lookup->SubTableCount; j++)
466 dump_lookup_subtable_gsub (indent + 1, j,
467 lookup->LookupType, lookup->SubTable + j);
469 for (j = 0; j < lookup->SubTableCount; j++)
470 dump_lookup_subtable_gpos (indent + 1, j,
471 lookup->LookupType, lookup->SubTable + j);
483 dump_lookup_subtable_gsub (int indent, int index, unsigned type,
484 OTF_LookupSubTable *subtable)
486 IPRINT ("(SubTable (%d) (Format %d)", index, subtable->Format);
491 if (subtable->Format == 1)
493 dump_coverage (indent, NULL, &subtable->Coverage);
494 IPRINT ("(DeltaGlyhpID #x%04X)",
495 subtable->sub.gsub.single1.DeltaGlyphID);
497 else if (subtable->Format == 2)
499 dump_coverage (indent, NULL, &subtable->Coverage);
500 IPRINT ("(GlyphCount %d)",
501 subtable->sub.gsub.single2.GlyphCount);
502 IPRINT ("(Substitute");
503 dump_glyph_ids (subtable->sub.gsub.single2.Substitute,
504 subtable->sub.gsub.single2.GlyphCount);
510 if (subtable->Format == 1)
512 dump_coverage (indent, NULL, &subtable->Coverage);
513 dump_sequence_list (indent,
514 subtable->sub.gsub.multiple1.Sequence,
515 subtable->sub.gsub.multiple1.SequenceCount);
520 if (subtable->Format == 1)
522 dump_coverage (indent, NULL, &subtable->Coverage);
523 dump_ligature_set_list (indent,
524 subtable->sub.gsub.ligature1.LigatureSet,
525 subtable->sub.gsub.ligature1.LigSetCount);
530 if (subtable->Format == 1)
533 read_coverage (fp, offset,
534 &subtable->sub.gsub.chain_context1.Coverage);
535 subtable->sub.gsub.chain_context1.ChainSubRuleSetCount
536 = (read_chain_subrule_set
538 &subtable->sub.gsub.chain_context1.ChainSubRuleSet));
541 else if (subtable->Format == 2)
544 read_coverage (fp, offset,
545 &subtable->sub.gsub.chain_context2.Coverage);
546 read_class_def (fp, offset,
547 &subtable->sub.gsub.chain_context2.Backtrack);
548 read_class_def (fp, offset,
549 &subtable->sub.gsub.chain_context2.Input);
550 read_class_def (fp, offset,
551 &subtable->sub.gsub.chain_context2.LookAhead);
552 subtable->sub.gsub.chain_context2.ChainSubClassSetCnt
553 = (read_chain_subclass_set
555 &subtable->sub.gsub.chain_context2.ChainSubClassSet));
558 else if (subtable->Format == 3)
561 (indent, "BackTrackGlyphCount",
562 subtable->sub.gsub.chain_context3.Backtrack,
563 subtable->sub.gsub.chain_context3.BacktrackGlyphCount);
565 (indent, "InputGlyphCount",
566 subtable->sub.gsub.chain_context3.Input,
567 subtable->sub.gsub.chain_context3.InputGlyphCount);
569 (indent, "LookaheaGlyphCount",
570 subtable->sub.gsub.chain_context3.LookAhead,
571 subtable->sub.gsub.chain_context3.LookaheadGlyphCount);
572 dump_subst_lookup_record_list
574 subtable->sub.gsub.chain_context3.SubstLookupRecord,
575 subtable->sub.gsub.chain_context3.SubstCount);
583 dump_gsub_table (int indent, OTF_GSUB *gsub)
589 IPRINT ("(Version %d.%d)", gsub->Version.high, gsub->Version.low);
590 IPRINT ("(ScriptList #x%04X)", gsub->ScriptList.offset);
591 IPRINT ("(FeatureList #x%04X)", gsub->FeatureList.offset);
592 IPRINT ("(LookupList #x%04X))", gsub->LookupList.offset);
594 dump_script_list (indent, &gsub->ScriptList);
595 dump_feature_list (indent, &gsub->FeatureList);
596 dump_lookup_list (indent, &gsub->LookupList, 1);
604 dump_lookup_subtable_gpos (int indent, int index, unsigned type,
605 OTF_LookupSubTable *subtable)
607 IPRINT ("(SubTable (%d) (Format %d)", index, subtable->Format);
613 if (subtable->Format == 1)
615 dump_coverage (indent, NULL, &subtable->sub.gpos.single1.Coverage);
616 IPRINT ("(DeltaGlyhpID #x%04X)",
617 subtable->sub.gsub.single1.DeltaGlyphID);
619 else if (subtable->Format == 2)
621 dump_coverage (indent, NULL, &subtable->sub.gsub.single2.Coverage);
622 IPRINT ("(GlyphCount %d)",
623 subtable->sub.gsub.single2.GlyphCount);
624 IPRINT ("(Substitute");
625 dump_glyph_ids (subtable->sub.gsub.single2.Substitute,
626 subtable->sub.gsub.single2.GlyphCount);
633 if (subtable->Format == 1)
635 dump_coverage (indent, NULL, &subtable->Coverage);
637 else if (subtable->Format == 2)
639 dump_coverage (indent, NULL, &subtable->Coverage);
640 IPRINT ("(ValueFormat1 #x%04X)",
641 subtable->sub.gpos.pair2.ValueFormat1);
642 IPRINT ("(ValueFormat2 #x%04X)",
643 subtable->sub.gpos.pair2.ValueFormat2);
644 dump_class_def (indent, "ClassDef1",
645 &subtable->sub.gpos.pair2.ClassDef1);
646 dump_class_def (indent, "ClassDef2",
647 &subtable->sub.gpos.pair2.ClassDef2);
648 IPRINT ("(Class1Count %d)",
649 subtable->sub.gpos.pair2.Class1Count);
650 IPRINT ("(Class2Count %d)",
651 subtable->sub.gpos.pair2.Class2Count);
652 dump_class1_record_list (indent,
653 subtable->sub.gpos.pair2.Class1Count,
654 subtable->sub.gpos.pair2.Class2Count,
655 subtable->sub.gpos.pair2.Class1Record);
660 if (subtable->Format == 1)
662 dump_coverage (indent, "Mark", &subtable->Coverage);
663 dump_coverage (indent, "Base",
664 &subtable->sub.gpos.mark_base1.BaseCoverage);
665 IPRINT ("(ClassCount %d)",
666 subtable->sub.gpos.mark_base1.ClassCount);
667 dump_mark_array (indent, &subtable->sub.gpos.mark_base1.MarkArray);
668 dump_base_array (indent, subtable->sub.gpos.mark_base1.ClassCount,
669 &subtable->sub.gpos.mark_base1.BaseArray);
674 if (subtable->Format == 1)
677 read_coverage (fp, offset,
678 &subtable->sub.gsub.chain_context1.Coverage);
679 subtable->sub.gsub.chain_context1.ChainSubRuleSetCount
680 = (read_chain_subrule_set
682 &subtable->sub.gsub.chain_context1.ChainSubRuleSet));
685 else if (subtable->Format == 2)
688 read_coverage (fp, offset,
689 &subtable->sub.gsub.chain_context2.Coverage);
690 read_class_def (fp, offset,
691 &subtable->sub.gsub.chain_context2.Backtrack);
692 read_class_def (fp, offset,
693 &subtable->sub.gsub.chain_context2.Input);
694 read_class_def (fp, offset,
695 &subtable->sub.gsub.chain_context2.LookAhead);
696 subtable->sub.gsub.chain_context2.ChainSubClassSetCnt
697 = (read_chain_subclass_set
699 &subtable->sub.gsub.chain_context2.ChainSubClassSet));
702 else if (subtable->Format == 3)
706 (indent, "BackTrackGlyphCount",
707 subtable->sub.gsub.chain_context3.Backtrack,
708 subtable->sub.gsub.chain_context3.BacktrackGlyphCount);
710 (indent, "InputGlyphCount",
711 subtable->sub.gsub.chain_context3.Input,
712 subtable->sub.gsub.chain_context3.InputGlyphCount);
714 (indent, "LookaheaGlyphCount",
715 subtable->sub.gsub.chain_context3.LookAhead,
716 subtable->sub.gsub.chain_context3.LookaheadGlyphCount);
717 dump_subst_lookup_record_list
719 subtable->sub.gsub.chain_context3.SubstLookupRecord,
720 subtable->sub.gsub.chain_context3.SubstCount);
730 dump_gpos_table (int indent, OTF_GPOS *gpos)
738 IPRINT ("(Version %d.%d)", gpos->Version.high, gpos->Version.low);
739 IPRINT ("(ScriptList #x%04X)", gpos->ScriptList.offset);
740 IPRINT ("(FeatureList #x%04X)", gpos->FeatureList.offset);
741 IPRINT ("(LookupList #x%04X))", gpos->LookupList.offset);
743 dump_script_list (indent, &gpos->ScriptList);
744 dump_feature_list (indent, &gpos->FeatureList);
745 dump_lookup_list (indent, &gpos->LookupList, 0);
751 dump_base_table (OTF_BASE *base)
756 dump_jstf_table (OTF_JSTF *jstf)
764 dump_gdef_header (int indent, OTF_GDEFHeader *header)
766 IPRINT ("(Header\n");
768 IPRINT ("(Version %d.%d)",
769 header->Version.high, header->Version.low);
770 IPRINT ("(GlyphClassDef #x%04X)", header->GlyphClassDef);
771 IPRINT ("(AttachList #x%04X)", header->AttachList);
772 IPRINT ("(LigCaretList #x%04X)", header->LigCaretList);
773 IPRINT ("(MarkAttachClassDef #x%04X))",
774 header->MarkAttachClassDef);
778 dump_attach_list (int indent, OTF_AttachList *list)
783 dump_lig_caret_list (int indent, OTF_LigCaretList *list)
787 IPRINT ("(LigCaretList");
789 dump_coverage (indent, NULL, &list->Coverage);
790 IPRINT ("(LigGlyphCount %d)", list->LigGlyphCount);
791 for (i = 0; i < list->LigGlyphCount; i++)
793 IPRINT ("(LigGlyph (%d) (offset #x%04X)",
794 i, list->LigGlyph[i].offset);
796 IPRINT ("(CaretCount %d)", list->LigGlyph[i].CaretCount);
797 for (j = 0; j < list->LigGlyph[i].CaretCount; j++)
799 unsigned format = list->LigGlyph[i].CaretValue[j].CaretValueFormat;
801 IPRINT ("(Caret (%d) (CaretValueFormat %d)", j, format);
804 printf ("(Coordinate %d)",
805 list->LigGlyph[i].CaretValue[j].f.f1.Coordinate);
807 else if (format == 2)
809 printf ("(CaretValuePoint %d)",
810 list->LigGlyph[i].CaretValue[j].f.f2.CaretValuePoint);
812 else if (format == 3)
814 printf ("(Coodinate %d)",
815 list->LigGlyph[i].CaretValue[j].f.f3.Coordinate);
818 (indent, "DeviceTable",
819 &list->LigGlyph[i].CaretValue[j].f.f3.DeviceTable);
831 dump_gdef_table (int indent, OTF_GDEF *gdef)
837 dump_gdef_header (indent, &gdef->header);
838 if (gdef->header.GlyphClassDef)
839 dump_class_def (indent, "GlyphClassDef", &gdef->glyph_class_def);
840 if (gdef->header.AttachList)
841 dump_attach_list (indent, &gdef->attach_list);
842 if (gdef->header.LigCaretList)
843 dump_lig_caret_list (indent, &gdef->lig_caret_list);
844 if (gdef->header.MarkAttachClassDef)
845 dump_class_def (indent, "MarkAttachClassDef",
846 &gdef->mark_attach_class_def);
853 dump_cmap_table (int indent, OTF_cmap *cmap)
859 IPRINT ("(version %d)", cmap->version);
860 IPRINT ("(numTables %d)", cmap->numTables);
861 for (i = 0; i < cmap->numTables; i++)
863 IPRINT ("(EncodingRecord (%d) (platformID %d) (encodingID %d)",
865 cmap->EncodingRecord[i].platformID,
866 cmap->EncodingRecord[i].encodingID);
868 IPRINT ("(Subtable (offset #x%04X) (format %d) (length #x%04X) (language %d)",
869 cmap->EncodingRecord[i].offset,
870 cmap->EncodingRecord[i].subtable.format,
871 cmap->EncodingRecord[i].subtable.length,
872 cmap->EncodingRecord[i].subtable.language);
874 switch (cmap->EncodingRecord[i].subtable.format)
880 = cmap->EncodingRecord[i].subtable.f.f0->glyphIdArray;
882 IPRINT ("(glyphIdArray");
883 for (j = 0; j < 16; j++)
886 for (k = 0; k < 16; k++)
887 printf (" %3d", array[j * 16 + k]);
895 OTF_EncodingSubtable4 *sub4
896 = cmap->EncodingRecord[i].subtable.f.f4;
899 IPRINT ("(segCountX2 %d) (searchRange %d)",
900 sub4->segCountX2, sub4->searchRange);
901 IPRINT ("(entrySelector %d) (rangeShift %d)",
902 sub4->entrySelector, sub4->rangeShift);
903 for (j = 0; j < sub4->segCountX2 / 2; j++)
905 IPRINT ("(Segment (%d)", j);
907 IPRINT ("(startCount #x%04X) (endCount #x%04X)",
908 sub4->segments[j].startCount,
909 sub4->segments[j].endCount);
910 IPRINT ("(idDelta %d) (idRangeOffset #x%04X))",
911 sub4->segments[j].idDelta,
912 sub4->segments[j].idRangeOffset);
915 IPRINT ("(glyphIdArray");
916 for (j = 0; j < sub4->GlyphCount; j++)
920 printf (" %3d", sub4->glyphIdArray[j]);
936 dump_name_table (int indent, OTF_name *name)
942 IPRINT ("(format %d)", name->format);
943 IPRINT ("(count %d)", name->count);
944 IPRINT ("(stringOffset %d)", name->stringOffset);
945 for (i = 0; i < name->count; i++)
947 OTF_NameRecord *rec = name->nameRecord + i;
949 IPRINT ("(nameRecord (%d)", i);
951 IPRINT ("(platformID %d) (encodingID %d) (languageID %d) (nameID %d)",
952 rec->platformID, rec->encodingID, rec->languageID, rec->nameID);
953 IPRINT ("(length %d) (offset #x%04X))", rec->length, rec->offset);
956 for (i = 0; i <= OTF_max_nameID; i++)
958 IPRINT ("(nameID %d \"%s\")", i, name->name[i]);
972 dump_offset_table (1, &otf->offset_table);
973 for (i = 0; i < otf->offset_table.numTables; i++)
974 dump_table_directory (1, otf->table_dirs + i, i);
977 dump_head_table (1, otf->head);
979 dump_name_table (1, otf->name);
981 dump_cmap_table (1, otf->cmap);
983 dump_gdef_table (1, otf->gdef);
985 dump_gsub_table (1, otf->gsub);
987 dump_gpos_table (1, otf->gpos);
990 dump_base_table (1, otf->base);
992 dump_jstf_table (1, otf->jstf);
999 main (int argc, char **argv)
1004 EF_PROTECT_BELOW = 1;
1005 EF_PROTECT_FREE = 1;
1009 fprintf (stderr, "Usage, dtfdump OTF-FILE");
1013 otf = otf_open (argv[1]);
1015 otf_perror ("otfdump: ", 1);
1016 otf_get_table (otf, "head");
1017 otf_get_table (otf, "name");
1018 otf_get_table (otf, "cmap");
1019 otf_get_table (otf, "GDEF");
1020 otf_get_table (otf, "GSUB");
1021 otf_get_table (otf, "GPOS");
1023 otf_get_table (otf, "BASE");
1024 otf_get_table (otf, "JSTF");