Imported Upstream version 1.8.1
[platform/upstream/harfbuzz.git] / src / hb-ot-layout-gsub-table.hh
index 5f67aed..bd72fe6 100644 (file)
@@ -269,7 +269,7 @@ struct Sequence
   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
-    c->output->add_array (substitute.array, substitute.len);
+    c->output->add_array (substitute.arrayZ, substitute.len);
   }
 
   inline bool apply (hb_ot_apply_context_t *c) const
@@ -281,7 +281,7 @@ struct Sequence
      * as a "multiplied" substitution. */
     if (unlikely (count == 1))
     {
-      c->replace_glyph (substitute.array[0]);
+      c->replace_glyph (substitute.arrayZ[0]);
       return_trace (true);
     }
     /* Spec disallows this, but Uniscribe allows it.
@@ -297,7 +297,7 @@ struct Sequence
 
     for (unsigned int i = 0; i < count; i++) {
       _hb_glyph_info_set_lig_props_for_component (&c->buffer->cur(), i);
-      c->output_glyph_for_component (substitute.array[i], klass);
+      c->output_glyph_for_component (substitute.arrayZ[i], klass);
     }
     c->buffer->skip_glyph ();
 
@@ -480,7 +480,7 @@ struct AlternateSubstFormat1
       if (unlikely (iter.get_coverage () >= count))
         break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
       const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
-      c->output->add_array (alt_set.array, alt_set.len);
+      c->output->add_array (alt_set.arrayZ, alt_set.len);
     }
   }
 
@@ -611,7 +611,7 @@ struct Ligature
   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
-    c->input->add_array (component.array, component.len ? component.len - 1 : 0);
+    c->input->add_array (component.arrayZ, component.len ? component.len - 1 : 0);
     c->output->add (ligGlyph);
   }
 
@@ -979,7 +979,7 @@ struct ReverseChainSingleSubstFormat1
 
     const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
     count = substitute.len;
-    c->output->add_array (substitute.array, substitute.len);
+    c->output->add_array (substitute.arrayZ, substitute.len);
   }
 
   inline const Coverage &get_coverage (void) const
@@ -1007,11 +1007,11 @@ struct ReverseChainSingleSubstFormat1
 
   unsigned int start_index = 0, end_index = 0;
     if (match_backtrack (c,
-                        backtrack.len, (HBUINT16 *) backtrack.array,
+                        backtrack.len, (HBUINT16 *) backtrack.arrayZ,
                         match_coverage, this,
                         &start_index) &&
         match_lookahead (c,
-                        lookahead.len, (HBUINT16 *) lookahead.array,
+                        lookahead.len, (HBUINT16 *) lookahead.arrayZ,
                         match_coverage, this,
                         1, &end_index))
     {
@@ -1156,10 +1156,13 @@ struct SubstLookup : Lookup
     return_trace (dispatch (c));
   }
 
-  inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
+  inline hb_closure_context_t::return_t closure (hb_closure_context_t *c, unsigned int this_index) const
   {
     TRACE_CLOSURE (this);
-    c->set_recurse_func (dispatch_recurse_func<hb_closure_context_t>);
+    if (!c->should_visit_lookup (this_index))
+      return_trace (HB_VOID);
+
+    c->set_recurse_func (dispatch_closure_recurse_func);
     return_trace (dispatch (c));
   }
 
@@ -1258,6 +1261,13 @@ struct SubstLookup : Lookup
   template <typename context_t>
   static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
 
+  static inline hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
+  {
+    if (!c->should_visit_lookup (lookup_index))
+      return HB_VOID;
+    return dispatch_recurse_func (c, lookup_index);
+  }
+
   template <typename context_t>
   inline typename context_t::return_t dispatch (context_t *c) const
   { return Lookup::dispatch<SubstLookupSubTable> (c); }
@@ -1287,7 +1297,8 @@ struct SubstLookup : Lookup
 typedef OffsetListOf<SubstLookup> SubstLookupList;
 
 /*
- * GSUB -- The Glyph Substitution Table
+ * GSUB -- Glyph Substitution
+ * https://docs.microsoft.com/en-us/typography/opentype/spec/gsub
  */
 
 struct GSUB : GSUBGPOS