Add a few other buffer methods
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 13 May 2010 03:43:00 +0000 (23:43 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 13 May 2010 03:43:00 +0000 (23:43 -0400)
src/hb-buffer-private.hh
src/hb-buffer.cc
src/hb-ot-layout-gsub-private.hh
src/hb-ot-layout-gsubgpos-private.hh

index b5e4550..73bae80 100644 (file)
@@ -94,10 +94,6 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
 HB_INTERNAL void
 _hb_buffer_next_glyph (hb_buffer_t *buffer);
 
-HB_INTERNAL void
-_hb_buffer_replace_glyph (hb_buffer_t *buffer,
-                         hb_codepoint_t glyph_index);
-
 
 
 struct _hb_buffer_t {
@@ -132,6 +128,13 @@ struct _hb_buffer_t {
   /* Methods */
   inline unsigned int allocate_lig_id (void) { return max_lig_id++; }
   inline void swap (void) { _hb_buffer_swap (this); }
+  inline void clear_output (void) { _hb_buffer_clear_output (this); }
+  inline void next_glyph (void) { _hb_buffer_next_glyph (this); }
+  inline void add_output_glyph (hb_codepoint_t glyph_index,
+                               unsigned short component = 0xFFFF,
+                               unsigned short ligID = 0xFFFF)
+  { _hb_buffer_add_output_glyph (this, glyph_index, component, ligID); }
+  inline void replace_glyph (hb_codepoint_t glyph_index) { add_output_glyph (glyph_index); }
 };
 
 
index de7a2eb..bad5dcd 100644 (file)
@@ -443,13 +443,6 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
   buffer->in_pos++;
 }
 
-void
-_hb_buffer_replace_glyph (hb_buffer_t *buffer,
-                         hb_codepoint_t glyph_index)
-{
-  _hb_buffer_add_output_glyph (buffer, glyph_index, 0xFFFF, 0xFFFF);
-}
-
 
 unsigned int
 hb_buffer_get_length (hb_buffer_t *buffer)
index 0101c4f..9a4b2e8 100644 (file)
@@ -49,7 +49,7 @@ struct SingleSubstFormat1
       return false;
 
     glyph_id += deltaGlyphID;
-    _hb_buffer_replace_glyph (context->buffer, glyph_id);
+    context->buffer->replace_glyph (glyph_id);
 
     /* We inherit the old glyph class to the substituted glyph */
     if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
@@ -93,7 +93,7 @@ struct SingleSubstFormat2
       return false;
 
     glyph_id = substitute[index];
-    _hb_buffer_replace_glyph (context->buffer, glyph_id);
+    context->buffer->replace_glyph (glyph_id);
 
     /* We inherit the old glyph class to the substituted glyph */
     if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
@@ -302,7 +302,7 @@ struct AlternateSubstFormat1
 
     glyph_id = alt_set[alt_index];
 
-    _hb_buffer_replace_glyph (context->buffer, glyph_id);
+    context->buffer->replace_glyph (glyph_id);
 
     /* We inherit the old glyph class to the substituted glyph */
     if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
@@ -832,7 +832,7 @@ struct SubstLookup : Lookup
     if (likely (!is_reverse ()))
     {
        /* in/out forward substitution */
-       _hb_buffer_clear_output (buffer);
+       buffer->clear_output ();
        buffer->in_pos = 0;
        while (buffer->in_pos < buffer->in_length)
        {
@@ -840,7 +840,7 @@ struct SubstLookup : Lookup
              apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
            ret = true;
          else
-           _hb_buffer_next_glyph (buffer);
+           buffer->next_glyph ();
 
        }
        if (ret)
index 066abbd..cefde13 100644 (file)
@@ -208,7 +208,7 @@ static inline bool apply_lookup (hb_apply_context_t *context,
       if (unlikely (context->buffer->in_pos == end))
        return true;
       /* No lookup applied for this index */
-      _hb_buffer_next_glyph (context->buffer);
+      context->buffer->next_glyph ();
     }
 
     if (lookupCount && i == lookupRecord->sequenceIndex)
@@ -232,7 +232,7 @@ static inline bool apply_lookup (hb_apply_context_t *context,
     {
     not_applied:
       /* No lookup applied for this index */
-      _hb_buffer_next_glyph (context->buffer);
+      context->buffer->next_glyph ();
       i++;
     }
   }