[subset] Fix serialize_subset() calls
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 3 Sep 2018 23:37:17 +0000 (16:37 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 3 Sep 2018 23:37:17 +0000 (16:37 -0700)
Ouch.

src/hb-open-type.hh
src/hb-ot-layout-common.hh
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsubgpos.hh

index 24fafd9..29afa94 100644 (file)
@@ -525,7 +525,7 @@ struct OffsetListOf : OffsetArrayOf<Type>
     if (unlikely (!out)) return_trace (false);
     unsigned int count = this->len;
     for (unsigned int i = 0; i < count; i++)
-      out->arrayZ[i].serialize_subset (c, (*this)[i], this);
+      out->arrayZ[i].serialize_subset (c, (*this)[i], out);
     return_trace (true);
   }
 
index de01bb4..343b62d 100644 (file)
@@ -144,7 +144,7 @@ struct RecordListOf : RecordArrayOf<Type>
     if (unlikely (!out)) return_trace (false);
     unsigned int count = this->len;
     for (unsigned int i = 0; i < count; i++)
-      out->get_offset (i).serialize_subset (c, (*this)[i], this);
+      out->get_offset (i).serialize_subset (c, (*this)[i], out);
     return_trace (true);
   }
 
@@ -283,10 +283,10 @@ struct Script
     TRACE_SUBSET (this);
     struct Script *out = c->serializer->embed (*this);
     if (unlikely (!out)) return_trace (false);
-    out->defaultLangSys.serialize_subset (c, this+defaultLangSys, this);
+    out->defaultLangSys.serialize_subset (c, this+defaultLangSys, out);
     unsigned int count = langSys.len;
     for (unsigned int i = 0; i < count; i++)
-      out->langSys.arrayZ[i].offset.serialize_subset (c, this+langSys[i].offset, this);
+      out->langSys.arrayZ[i].offset.serialize_subset (c, this+langSys[i].offset, out);
     return_trace (true);
   }
 
index d6518b9..5b913c7 100644 (file)
@@ -1402,14 +1402,13 @@ struct GSUB : GSUBGPOS
   inline bool subset (hb_subset_context_t *c) const
   {
     TRACE_SUBSET (this);
-    //struct GSUB *out = c->serializer->start_embed<GSUB> ();
+    struct GSUB *out = c->serializer->start_embed<GSUB> ();
     if (unlikely (!GSUBGPOS::subset (c))) return_trace (false);
-    /* TODO Replace following with c->iter_copy_and_subset()ish. */
-    unsigned int count = get_lookup_count ();
-    //LookupList &outLookupList = out+out->lookupList;
-    for (unsigned int i = 0; i < count; i++)
-      //XXX if (unlikely (!outLookupList.arrayZ[i].subset (c, get_lookup (i), &outLookupList)))
-       return_trace (false);
+    const OffsetTo<SubstLookupList> &list = CastR<const OffsetTo<SubstLookupList> > (lookupList);
+    OffsetTo<SubstLookupList> &outList = CastR<OffsetTo<SubstLookupList> > (out->lookupList);
+    outList.set (0);
+    //outList.serialize_subset (c, this+list, out);
+    /* TODO Use intersects() to count how many subtables survive? */
     return_trace (true);
   }
 
index e4399ae..6b163dc 100644 (file)
@@ -2551,11 +2551,11 @@ struct GSUBGPOS
     TRACE_SUBSET (this);
     struct GSUBGPOS *out = c->serializer->embed (*this);
     if (unlikely (!out)) return_trace (false);
-    out->scriptList.serialize_subset (c, this+scriptList, this);
-    out->featureList.serialize_subset (c, this+featureList, this);
+    out->scriptList.serialize_subset (c, this+scriptList, out);
+    out->featureList.serialize_subset (c, this+featureList, out);
     out->lookupList.set (0); /* GSUB/GPOS fill this one in. */
     if (version.to_int () >= 0x00010001u)
-     out->featureVars.serialize_subset (c, this+featureVars, this);
+     out->featureVars.serialize_subset (c, this+featureVars, out);
     return_trace (true);
   }