(gstring_subst): If otf->cmap is NULL, set
authorhanda <handa>
Mon, 6 Aug 2007 11:13:06 +0000 (11:13 +0000)
committerhanda <handa>
Mon, 6 Aug 2007 11:13:06 +0000 (11:13 +0000)
character code of a glyph to 0.
(OTF_drive_gsub): If otf->cmap is NULL, try to load it.

src/otfdrive.c

index 44ec9e5..a822704 100644 (file)
@@ -102,7 +102,10 @@ gstring_subst (OTF *otf, OTF_GlyphString *gstring, int from, int to, int flag,
     GSTRING_DELETE (gstring, from, (len - num));
   for (i = 0; i < num; i++)
     {
-      gstring->glyphs[from + i].c = otf->cmap->decode_table[ids[i]];
+      if (otf->cmap)
+       gstring->glyphs[from + i].c = otf->cmap->decode_table[ids[i]];
+      else
+       gstring->glyphs[from + i].c = 0;
       gstring->glyphs[from + i].glyph_id = ids[i];
       if (otf->gdef)
        gstring->glyphs[from + i].GlyphClass
@@ -1426,6 +1429,8 @@ int
 OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring,
                const char *script, const char *language, const char *features)
 {
+  if (! otf->cmap)
+    OTF_get_table (otf, "cmap");
   return OTF_drive_gsub_internal (otf, gstring, script, language, features, 0);
 }