*** empty log message ***
[m17n/libotf.git] / src / otfdrive.c
index 44ec9e5..3dc6eda 100644 (file)
@@ -102,13 +102,16 @@ 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 (gstring->glyphs[from + i].glyph_id != ids[i])
+       {
+         gstring->glyphs[from + i].c = 0;
+         if (otf->gdef)
+           gstring->glyphs[from + i].GlyphClass
+             = get_class_def (&otf->gdef->glyph_class_def, ids[i]);
+         else
+           gstring->glyphs[from + i].GlyphClass = 0;
+       }
       gstring->glyphs[from + i].glyph_id = ids[i];
-      if (otf->gdef)
-       gstring->glyphs[from + i].GlyphClass
-         = get_class_def (&otf->gdef->glyph_class_def, ids[i]);
-      else
-       gstring->glyphs[from + i].GlyphClass = 0;
       gstring->glyphs[from + i].positioning_type = 0;
       gstring->glyphs[from + i].f.index.from = from_idx;
       gstring->glyphs[from + i].f.index.to = to_idx;
@@ -760,7 +763,7 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index,
   int i;
 
   if (IGNORED_GLYPH (g, flag)
-      || g->positioning_type)
+      || (0 & g->positioning_type))
     return (gidx + 1);
 
   /* Try all subtables until one of them handles the current glyph.  */
@@ -812,7 +815,7 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index,
            OTF_Glyph *nextg;
 
            for (next_gidx = gidx + 1, nextg = gstring->glyphs + next_gidx;
-                next_gidx < gstring->used && ! IGNORED_GLYPH (nextg, flag);
+                next_gidx < gstring->used && IGNORED_GLYPH (nextg, flag);
                 next_gidx++, nextg++);
 
            if (next_gidx >= gstring->used
@@ -893,9 +896,10 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index,
              OTF_AnchorRecord *base_record;
              OTF_Glyph *baseg;
              int coverage_idx_base;
+             unsigned int this_flag = flag | OTF_IgnoreMarks;
 
              for (baseg = g - 1;
-                  baseg >= gstring->glyphs && IGNORED_GLYPH (baseg, flag);
+                  baseg >= gstring->glyphs && IGNORED_GLYPH (baseg, this_flag);
                   baseg--);
              if (baseg < gstring->glyphs)
                continue;
@@ -1426,6 +1430,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);
 }