(get_anchor): Delete it.
[m17n/libotf.git] / example / otfdump.c
index abbb43e..f5961e5 100644 (file)
@@ -1,6 +1,6 @@
 /* otfdump.c -- Dump OpenType Layout Tables.
 
-Copyright (C) 2003, 2004
+Copyright (C) 2003, 2004, 2008
   National Institute of Advanced Industrial Science and Technology (AIST)
   Registration Number H15PRO167
 
@@ -306,10 +306,14 @@ dump_device_table (int indent, char *title, OTF_DeviceTable *table)
   indent++;
   IPRINT ("(StartSize %d) (EndSize %d) (DeltaFormat %d)",
          table->StartSize, table->EndSize, table->DeltaFormat);
-  IPRINT ("(DeltaValue");
-  for (i = 0; i < table->EndSize - table->StartSize + 1; i++)
-    printf (" %d", table->DeltaValue[i]);
-  printf ("))");
+  if (table->DeltaValue)
+    {
+      IPRINT ("(DeltaValue");
+      for (i = 0; i < table->EndSize - table->StartSize + 1; i++)
+       printf (" %d", table->DeltaValue[i]);
+      printf (")");
+    }
+  printf (")");
 }
 
 \f
@@ -711,13 +715,14 @@ dump_chain_class_set_list (int indent, OTF_ChainClassSet *set, int count)
 
   IPRINT ("(ChainClassSetCount %d)", count);
   for (i = 0; i < count; i++)
-    {
-      IPRINT ("(ChainClassSet (%d)", i);
-      dump_chain_class_rule_list (indent + 1,
-                                 set[i].ChainClassRule,
-                                 set[i].ChainClassRuleCnt);
-      printf (")");
-    }
+    if (set[i].offset)
+      {
+       IPRINT ("(ChainClassSet (%d)", i);
+       dump_chain_class_rule_list (indent + 1,
+                                   set[i].ChainClassRule,
+                                   set[i].ChainClassRuleCnt);
+       printf (")");
+      }
 }
 
 
@@ -1356,6 +1361,75 @@ dump_cmap_table (int indent, OTF_cmap *cmap)
            printf (")");
          }
          break;
+
+       case 12:
+         {
+           OTF_EncodingSubtable12 *sub12
+             = cmap->EncodingRecord[i].subtable.f.f12;
+           int j;
+
+           for (j = 0; j < sub12->nGroups; j++)
+             {
+               IPRINT ("(Group (#x%X) (startChar #x%04X) (endChar #x%04X) (startGlyphID #x%X))",
+                       j,
+                       sub12->Groups[j].startCharCode,
+                       sub12->Groups[j].endCharCode,
+                       sub12->Groups[j].startGlyphID);
+             }
+         }
+         break;
+
+       case 14:
+         {
+           OTF_EncodingSubtable14 *sub14
+             = cmap->EncodingRecord[i].subtable.f.f14;
+           unsigned j,k;
+
+           IPRINT ("(VariationSelectorRecords %d)",sub14->nRecords);
+           for (j = 0; j < sub14->nRecords; j++)
+             {
+               OTF_VariationSelectorRecord *record = sub14->Records + j;
+               IPRINT ("(VariationSelectorRecord (varSelector #x%x)",
+                       record->varSelector);
+               indent += 1;
+               IPRINT ("(defaultUVSOffset #x%x)",
+                       record->defaultUVSOffset);
+               if (record->defaultUVSOffset) 
+                 {
+                   IPRINT ("(defaultUVS");
+                   indent += 1;
+                   for (k = 0 ; k < record->numUnicodeValueRanges; k++)
+                     {
+                       OTF_UnicodeValueRange *unicodeValueRange
+                         = &record->unicodeValueRanges[k];
+                       IPRINT("(startUnicodeValue #x%x) (additionalCount %d)",
+                              unicodeValueRange->startUnicodeValue,
+                              unicodeValueRange->additionalCount);
+                     }
+                   printf (")");
+                   indent -= 1;
+                 }
+               IPRINT ("(nonDefaultUVSOffset #x%x)",
+                       record->nonDefaultUVSOffset);
+               if (record->nonDefaultUVSOffset) 
+                 {
+                   IPRINT ("(NonDefaultUVS");
+                   indent += 1;
+                   for (k=0; k < record->numUVSMappings; k++)
+                     {
+                       OTF_UVSMapping *uvsMapping
+                         = &record->uvsMappings[k];
+                       IPRINT("(unicodeValue #x%x) (glyphID %d)",
+                              uvsMapping->unicodeValue,
+                              uvsMapping->glyphID);
+                     }
+                   printf (")");
+                   indent -= 1;
+                 }
+               printf (")");
+               indent -= 1;
+             }
+         }
        }
 
       indent -= 2;