*** empty log message ***
authorhanda <handa>
Fri, 13 Dec 2002 13:36:12 +0000 (13:36 +0000)
committerhanda <handa>
Fri, 13 Dec 2002 13:36:12 +0000 (13:36 +0000)
example/otfdump.c
src/otf.h
src/otfdrive.c

index 18b8233..0d692ab 100644 (file)
@@ -761,7 +761,7 @@ dump_jstf_table (OTF_JSTF *jstf)
 static void
 dump_gdef_header (int indent, OTF_GDEFHeader *header)
 {
-  IPRINT ("(Header\n");
+  IPRINT ("(Header");
   indent++;
   IPRINT ("(Version %d.%d)",
          header->Version.high, header->Version.low);
index f6e556c..d52b39b 100644 (file)
--- a/src/otf.h
+++ b/src/otf.h
@@ -1167,7 +1167,8 @@ extern int otf_drive_gpos (OTF *otf, OTF_GlyphString *gstring,
     order, and update the glyphs string GSTRING.  */
 
 extern int otf_drive_tables (OTF *otf, OTF_GlyphString *gstring,
-                            char *script, char *language);
+                            char *script, char *language,
+                            char *gsub_features, char *gpos_features);
 
 
 /*** (4) APIs for error handling ***/
index dedbec3..8cbfce5 100644 (file)
@@ -87,7 +87,7 @@ get_class_def (OTF_ClassDef *class_def, OTF_GlyphID glyph_id)
 
       for (i = 0; i < class_def->f.f2.ClassRangeCount; i++)
        if (glyph_id >= class_def->f.f2.ClassRangeRecord[i].Start
-           && glyph_id >= class_def->f.f2.ClassRangeRecord[i].End)
+           && glyph_id <= class_def->f.f2.ClassRangeRecord[i].End)
          return class_def->f.f2.ClassRangeRecord[i].Class;
     }
   return 0;
@@ -130,7 +130,7 @@ get_feature_index (OTF_LangSys *LangSys, OTF_FeatureList *FeatureList,
 
       p0 = alloca (len);
       for (p1 = p0; *p1; p1++)
-       if (*p1 == ':')
+       if (*p1 == ',')
          *p1 = '\0';
       
       while (len > 0)
@@ -271,6 +271,9 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index,
                                        gstring->glyphs[back_gidx + j].glyph_id)
                    < 0)
                  break;
+             if (j < context3->BacktrackGlyphCount)
+               continue;
+
              /* Start from the secoding coverage_idx because the
                 first one is the same as subtable->Coverage and thus
                 already tested */
@@ -279,11 +282,16 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index,
                                        gstring->glyphs[gidx + j].glyph_id)
                    < 0)
                  break;
+             if (j < context3->InputGlyphCount)
+               continue;
+
              for (j = 0; j < context3->LookaheadGlyphCount; j++)
                if (get_coverage_index (context3->LookAhead + j,
                                        gstring->glyphs[fore_gidx + j].glyph_id)
                    < 0)
                  break;
+             if (j < context3->LookaheadGlyphCount)
+               continue;
 
              orig_used = gstring->used;
              for (j = 0; j < context3->SubstCount; j++)
@@ -414,7 +422,6 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index,
              OTF_GPOS_MarkBase1 *mark_base1 = &subtable->u.mark_base1;
              OTF_MarkRecord *mark_record;
              OTF_BaseRecord *base_record;
-             OTF_Anchor *anchor1, *anchor2;
              int coverage_idx_base
                = get_coverage_index (&mark_base1->BaseCoverage,
                                      g[-1].glyph_id);
@@ -425,11 +432,10 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index,
              mark_record = mark_base1->MarkArray.MarkRecord + coverage_idx;
              base_record
                = mark_base1->BaseArray.BaseRecord + coverage_idx_base;
-             anchor1 = &mark_record->MarkAnchor;
-             anchor2 = &base_record->BaseAnchor[mark_record->Class];
+             g->f.f4.mark_anchor = &mark_record->MarkAnchor;
+             g->f.f4.base_anchor
+               = &base_record->BaseAnchor[mark_record->Class];
              g->positioning_type = lookup->LookupType;
-             g->f.f4.mark_anchor = anchor1;
-             g->f.f4.base_anchor = anchor2;
              break;
            }
          else
@@ -634,15 +640,18 @@ otf_drive_gpos (OTF *otf, OTF_GlyphString *gstring,
 
 int
 otf_drive_tables (OTF *otf, OTF_GlyphString *gstring,
-                 char *script, char *language)
+                 char *script, char *language,
+                 char *gsub_features, char *gpos_features)
 {
   if (otf_drive_cmap (otf, gstring) < 0)
     return -1;
   if (otf_drive_gdef (otf, gstring) < 0)
     return -1;
-  if (otf_drive_gsub (otf, gstring, script, language, NULL) < 0)
+  if ((! gsub_features || gsub_features[0])
+      && otf_drive_gsub (otf, gstring, script, language, gsub_features) < 0)
     return -1;
-  if (otf_drive_gpos (otf, gstring, script, language, NULL) < 0)
+  if ((! gpos_features || gpos_features[0])
+      && otf_drive_gpos (otf, gstring, script, language, gpos_features) < 0)
     return -1;
   return 0;
 }