[GSUB] Minor refactoring
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 5 May 2009 20:22:02 +0000 (16:22 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 2 Nov 2009 19:40:07 +0000 (14:40 -0500)
src/hb-ot-layout-gsub-private.h

index d141823..f697036 100644 (file)
@@ -183,6 +183,28 @@ struct Sequence {
       _hb_ot_layout_set_glyph_property (layout, substitute[n], property);
   }
 
+  inline bool substitute_sequence (SUBTABLE_SUBSTITUTE_ARGS_DEF, unsigned int property) const {
+
+    if (HB_UNLIKELY (!get_len ()))
+      return false;
+
+    _hb_buffer_add_output_glyph_ids (buffer, 1,
+                                    glyphCount, substitute,
+                                    0xFFFF, 0xFFFF);
+
+    if ( _hb_ot_layout_has_new_glyph_classes (layout) )
+    {
+      /* this is a guess only ... */
+
+      if ( property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE )
+        property = HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
+
+      set_glyph_class (layout, property);
+    }
+
+    return true;
+  }
+
   private:
   USHORT       glyphCount;             /* Number of GlyphIDs in the Substitute
                                         * array. This should always  be
@@ -215,25 +237,7 @@ struct MultipleSubstFormat1 {
     unsigned int index = get_glyph_coverage (glyph_id);
 
     const Sequence &seq = (*this)[index];
-
-    if (HB_UNLIKELY (!seq.get_len ()))
-      return false;
-
-    _hb_buffer_add_output_glyph_ids (buffer, 1,
-                                    seq.glyphCount, seq.substitute,
-                                    0xFFFF, 0xFFFF);
-
-    if ( _hb_ot_layout_has_new_glyph_classes (layout) )
-    {
-      /* this is a guess only ... */
-
-      if ( property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE )
-        property = HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
-
-      seq.set_glyph_class (layout, property);
-    }
-
-    return true;
+    return seq.substitute_sequence (SUBTABLE_SUBSTITUTE_ARGS, property);
   }
 
   private: