From 1d5e78013696b10751d8a35027619e81978e1312 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 12 May 2010 23:43:00 -0400 Subject: [PATCH] Add a few other buffer methods --- src/hb-buffer-private.hh | 11 +++++++---- src/hb-buffer.cc | 7 ------- src/hb-ot-layout-gsub-private.hh | 10 +++++----- src/hb-ot-layout-gsubgpos-private.hh | 4 ++-- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh index b5e45503c..73bae80c4 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer-private.hh @@ -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); } }; diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index de7a2eb65..bad5dcd09 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -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) diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index 0101c4f4c..9a4b2e8b3 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -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) diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 066abbdb0..cefde13ce 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -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++; } }