(lookup_gsub): Change the meaning of the arg
authorhanda <handa>
Fri, 22 Jan 2010 12:23:31 +0000 (12:23 +0000)
committerhanda <handa>
Fri, 22 Jan 2010 12:23:31 +0000 (12:23 +0000)
alternate_subst.

src/otfdrive.c

index c807e56..fc65cf3 100644 (file)
@@ -440,7 +440,8 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
        }
 
       if (alternate_subst
-         ? (lookup_type != 3 && lookup_type != 5 && lookup_type != 6)
+         ? (alternate_subst == 1
+            && lookup_type != 3 && lookup_type != 5 && lookup_type != 6)
          : (lookup_type == 3))
        continue;
 
@@ -491,8 +492,12 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
              OTF_GSUB_Alternate1 *alt1 = &subtable->u.alternate1;
              OTF_AlternateSet *altset = alt1->AlternateSet + coverage_idx;
 
-             gstring_subst (otf, gstring, gidx, gidx + 1, flag,
-                            altset->Alternate, altset->GlyphCount);
+             if (alternate_subst == 1)
+               gstring_subst (otf, gstring, gidx, gidx + 1, flag,
+                              altset->Alternate, altset->GlyphCount);
+             else
+               gstring_subst (otf, gstring, gidx, gidx + 1, flag,
+                              altset->Alternate, 1);
              gidx += altset->GlyphCount;;
            }
          else
@@ -547,7 +552,7 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
                                 rule->LookupRecord[k].LookupListIndex,
                                 gstring,
                                 gidx + rule->LookupRecord[k].SequenceIndex,
-                                alternate_subst);
+                                alternate_subst ? alternate_subst : 2);
                  gidx += rule->GlyphCount + (gstring->used - orig_used);
                  break;
                }
@@ -578,7 +583,7 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
                                   rule->LookupRecord[k].LookupListIndex,
                                   gstring,
                                   gidx + rule->LookupRecord[k].SequenceIndex,
-                                  alternate_subst);
+                                  alternate_subst ? alternate_subst : 2);
                    gidx += rule->GlyphCount + (gstring->used - orig_used);
                    break;
                  }
@@ -599,7 +604,7 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
                             context3->LookupRecord[j].LookupListIndex,
                             gstring,
                             gidx + context3->LookupRecord[j].SequenceIndex,
-                            alternate_subst);
+                            alternate_subst ? alternate_subst : 2);
              gidx += context3->GlyphCount + (gstring->used - orig_used);
            }
          break;
@@ -628,7 +633,7 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
                                 rule->LookupRecord[k].LookupListIndex,
                                 gstring,
                                 gidx + rule->LookupRecord[k].SequenceIndex,
-                                alternate_subst);
+                                alternate_subst ? alternate_subst : 2);
                  gidx += rule->InputGlyphCount + (gstring->used - orig_used);
                  break;
                }
@@ -664,7 +669,7 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
                                 rule->LookupRecord[k].LookupListIndex,
                                 gstring,
                                 gidx + rule->LookupRecord[k].SequenceIndex,
-                                alternate_subst);
+                                alternate_subst ? alternate_subst : 2);
                  gidx += rule->InputGlyphCount + (gstring->used - orig_used);
                  break;
                }
@@ -687,7 +692,7 @@ lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index,
                             context3->LookupRecord[j].LookupListIndex,
                             gstring,
                             gidx + context3->LookupRecord[j].SequenceIndex,
-                            alternate_subst);
+                            alternate_subst ? alternate_subst : 2);
              gidx += context3->InputGlyphCount + (gstring->used - orig_used);
            }
          break;