*** empty log message ***
[m17n/libotf.git] / src / otfdrive.c
index 3dd3c16..c807e56 100644 (file)
@@ -112,11 +112,14 @@ gstring_subst (OTF *otf, OTF_GlyphString *gstring, int from, int to, int flag,
       if (gstring->glyphs[from + i].glyph_id != ids[i])
        {
          gstring->glyphs[from + i].c = 0;
-         if (otf->gdef)
+         if (otf->gdef && otf->gdef->glyph_class_def.offset)
            gstring->glyphs[from + i].GlyphClass
              = get_class_def (&otf->gdef->glyph_class_def, ids[i]);
          else
            gstring->glyphs[from + i].GlyphClass = 0;
+         if (otf->gdef && otf->gdef->mark_attach_class_def.offset)
+           gstring->glyphs[from + i].MarkAttachClass
+             = get_class_def (&otf->gdef->mark_attach_class_def, ids[i]);
        }
       gstring->glyphs[from + i].glyph_id = ids[i];
       gstring->glyphs[from + i].positioning_type = 1;
@@ -456,6 +459,14 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
            g->glyph_id += subtable->u.single1.DeltaGlyphID;
          else
            g->glyph_id = subtable->u.single2.Substitute[coverage_idx];
+         if (otf->gdef && otf->gdef->glyph_class_def.offset)
+           g->GlyphClass
+             = get_class_def (&otf->gdef->glyph_class_def, g->glyph_id);
+         else
+           g->GlyphClass = 0;
+         if (otf->gdef && otf->gdef->mark_attach_class_def.offset)
+           g->MarkAttachClass
+             = get_class_def (&otf->gdef->mark_attach_class_def, g->glyph_id);
          g->positioning_type = 1;
          gidx++;
          break;
@@ -1692,19 +1703,17 @@ OTF_get_variation_glyphs (OTF *otf, int c, OTF_GlyphID code[256])
   return n;
 }
 
-
 int
 OTF_drive_gdef (OTF *otf, OTF_GlyphString *gstring)
 {
   OTF_GDEF *gdef;
   int i;
 
-  if (! otf->gdef
-      && OTF_get_table (otf, "GDEF") < 0)
-    return -1;
+  if (! otf->gdef)
+    OTF_get_table (otf, "GDEF");
   gdef = otf->gdef;
 
-  if (gdef->glyph_class_def.offset)
+  if (gdef && gdef->glyph_class_def.offset)
     for (i = 0; i < gstring->used; i++)
       gstring->glyphs[i].GlyphClass
        = get_class_def (&gdef->glyph_class_def,