[GX] Make FeatureVariations actually work
authorBehdad Esfahbod <behdad@behdad.org>
Sat, 10 Sep 2016 11:52:34 +0000 (04:52 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 17 Dec 2016 01:06:26 +0000 (19:06 -0600)
Yay!!!!

src/hb-ot-layout-common-private.hh
src/hb-ot-layout-gsubgpos-private.hh

index cdf43bf4031923a740029653456b1659419c492d..971c95a0aa38bae02b4d110f1ab451cb9be5f971 100644 (file)
@@ -1417,17 +1417,12 @@ struct ConditionSet
 
 struct FeatureTableSubstitutionRecord
 {
-  inline const Feature *find_substitute (unsigned int feature_index) const
-  {
-    if (featureIndex == feature_index)
-      return &(this+feature);
-    return NULL;
-  }
+  friend struct FeatureTableSubstitution;
 
-  inline bool sanitize (hb_sanitize_context_t *c) const
+  inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && feature.sanitize (c, this));
+    return_trace (c->check_struct (this) && feature.sanitize (c, base));
   }
 
   protected:
@@ -1444,9 +1439,9 @@ struct FeatureTableSubstitution
     unsigned int count = substitutions.len;
     for (unsigned int i = 0; i < count; i++)
     {
-      const Feature *feature = (this+substitutions.array[i]).find_substitute (feature_index);
-      if (feature)
-        return feature;
+      const FeatureTableSubstitutionRecord &record = substitutions.array[i];
+      if (record.featureIndex == feature_index)
+       return &(this+record.feature);
     }
     return NULL;
   }
@@ -1461,7 +1456,7 @@ struct FeatureTableSubstitution
 
   protected:
   FixedVersion<>       version;        /* Version--0x00010000u */
-  OffsetArrayOf<FeatureTableSubstitutionRecord, ULONG>
+  ArrayOf<FeatureTableSubstitutionRecord>
                        substitutions;
   public:
   DEFINE_SIZE_ARRAY (6, substitutions);
index adea32f2344242ca6236b7ecbf00652df2c2882c..b90af9ca027493aef09e703e98c76403c8070557 100644 (file)
@@ -2281,7 +2281,8 @@ struct GSUBGPOS
     if (FeatureVariations::NOT_FOUND_INDEX != variations_index &&
        version.to_int () >= 0x00010001u)
     {
-      const Feature *feature = (this+featureVars).find_substitute (variations_index, feature_index);
+      const Feature *feature = (this+featureVars).find_substitute (variations_index,
+                                                                  feature_index);
       if (feature)
         return *feature;
     }