Add a few other buffer methods

This commit is contained in:
Behdad Esfahbod 2010-05-12 23:43:00 -04:00
parent d0316a81f5
commit 1d5e780136
4 changed files with 14 additions and 18 deletions

View File

@ -94,10 +94,6 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
HB_INTERNAL void HB_INTERNAL void
_hb_buffer_next_glyph (hb_buffer_t *buffer); _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 { struct _hb_buffer_t {
@ -132,6 +128,13 @@ struct _hb_buffer_t {
/* Methods */ /* Methods */
inline unsigned int allocate_lig_id (void) { return max_lig_id++; } inline unsigned int allocate_lig_id (void) { return max_lig_id++; }
inline void swap (void) { _hb_buffer_swap (this); } 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); }
}; };

View File

@ -443,13 +443,6 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
buffer->in_pos++; 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 unsigned int
hb_buffer_get_length (hb_buffer_t *buffer) hb_buffer_get_length (hb_buffer_t *buffer)

View File

@ -49,7 +49,7 @@ struct SingleSubstFormat1
return false; return false;
glyph_id += deltaGlyphID; 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 */ /* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face)) if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
@ -93,7 +93,7 @@ struct SingleSubstFormat2
return false; return false;
glyph_id = substitute[index]; 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 */ /* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face)) if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
@ -302,7 +302,7 @@ struct AlternateSubstFormat1
glyph_id = alt_set[alt_index]; 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 */ /* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face)) if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
@ -832,7 +832,7 @@ struct SubstLookup : Lookup
if (likely (!is_reverse ())) if (likely (!is_reverse ()))
{ {
/* in/out forward substitution */ /* in/out forward substitution */
_hb_buffer_clear_output (buffer); buffer->clear_output ();
buffer->in_pos = 0; buffer->in_pos = 0;
while (buffer->in_pos < buffer->in_length) while (buffer->in_pos < buffer->in_length)
{ {
@ -840,7 +840,7 @@ struct SubstLookup : Lookup
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL)) apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
ret = true; ret = true;
else else
_hb_buffer_next_glyph (buffer); buffer->next_glyph ();
} }
if (ret) if (ret)

View File

@ -208,7 +208,7 @@ static inline bool apply_lookup (hb_apply_context_t *context,
if (unlikely (context->buffer->in_pos == end)) if (unlikely (context->buffer->in_pos == end))
return true; return true;
/* No lookup applied for this index */ /* No lookup applied for this index */
_hb_buffer_next_glyph (context->buffer); context->buffer->next_glyph ();
} }
if (lookupCount && i == lookupRecord->sequenceIndex) if (lookupCount && i == lookupRecord->sequenceIndex)
@ -232,7 +232,7 @@ static inline bool apply_lookup (hb_apply_context_t *context,
{ {
not_applied: not_applied:
/* No lookup applied for this index */ /* No lookup applied for this index */
_hb_buffer_next_glyph (context->buffer); context->buffer->next_glyph ();
i++; i++;
} }
} }