[HB] Simplify buffer
This commit is contained in:
parent
36f78446ce
commit
15c3e75b39
|
@ -59,12 +59,11 @@ _hb_buffer_add_output_glyph ( HB_Buffer buffer,
|
|||
HB_UShort ligID );
|
||||
|
||||
HB_INTERNAL HB_Error
|
||||
_hb_buffer_copy_output_glyph ( HB_Buffer buffer );
|
||||
_hb_buffer_next_glyph ( HB_Buffer buffer );
|
||||
|
||||
HB_INTERNAL HB_Error
|
||||
_hb_buffer_replace_output_glyph ( HB_Buffer buffer,
|
||||
HB_UInt glyph_index,
|
||||
HB_Bool inplace );
|
||||
_hb_buffer_replace_glyph ( HB_Buffer buffer,
|
||||
HB_UInt glyph_index );
|
||||
|
||||
HB_INTERNAL HB_UShort
|
||||
_hb_buffer_allocate_ligid( HB_Buffer buffer );
|
||||
|
@ -96,11 +95,10 @@ _hb_buffer_allocate_ligid( HB_Buffer buffer );
|
|||
( ( error = _hb_buffer_add_output_glyph( (buffer), \
|
||||
(glyph_index), (component), (ligID) \
|
||||
) ) != HB_Err_Ok )
|
||||
#define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \
|
||||
( ( error = _hb_buffer_replace_output_glyph( (buffer), (glyph_index), \
|
||||
(nesting_level) == 1 ) ) != HB_Err_Ok )
|
||||
#define REPLACE_Glyph( buffer, glyph_index ) \
|
||||
( ( error = _hb_buffer_replace_glyph( (buffer), (glyph_index) ) ) != HB_Err_Ok )
|
||||
#define COPY_Glyph( buffer ) \
|
||||
( (error = _hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok )
|
||||
( (error = _hb_buffer_next_glyph ( buffer ) ) != HB_Err_Ok )
|
||||
|
||||
HB_END_HEADER
|
||||
|
||||
|
|
|
@ -208,6 +208,8 @@ _hb_buffer_clear_output( HB_Buffer buffer )
|
|||
HB_INTERNAL HB_Error
|
||||
_hb_buffer_clear_positions( HB_Buffer buffer )
|
||||
{
|
||||
_hb_buffer_clear_output (buffer);
|
||||
|
||||
if ( !buffer->positions )
|
||||
{
|
||||
HB_Error error;
|
||||
|
@ -328,16 +330,16 @@ _hb_buffer_add_output_glyph( HB_Buffer buffer,
|
|||
}
|
||||
|
||||
HB_INTERNAL HB_Error
|
||||
_hb_buffer_copy_output_glyph ( HB_Buffer buffer )
|
||||
_hb_buffer_next_glyph ( HB_Buffer buffer )
|
||||
{
|
||||
HB_Error error;
|
||||
|
||||
if ( buffer->separate_out )
|
||||
{
|
||||
error = hb_buffer_ensure( buffer, buffer->out_pos + 1 );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
if ( buffer->separate_out )
|
||||
{
|
||||
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
|
||||
}
|
||||
|
||||
|
@ -349,20 +351,19 @@ _hb_buffer_copy_output_glyph ( HB_Buffer buffer )
|
|||
}
|
||||
|
||||
HB_INTERNAL HB_Error
|
||||
_hb_buffer_replace_output_glyph( HB_Buffer buffer,
|
||||
HB_UInt glyph_index,
|
||||
HB_Bool inplace )
|
||||
_hb_buffer_replace_glyph( HB_Buffer buffer,
|
||||
HB_UInt glyph_index )
|
||||
{
|
||||
|
||||
HB_Error error;
|
||||
|
||||
if ( inplace )
|
||||
if ( !buffer->separate_out )
|
||||
{
|
||||
error = _hb_buffer_copy_output_glyph ( buffer );
|
||||
if ( error )
|
||||
return error;
|
||||
buffer->out_string[buffer->out_pos].gindex = glyph_index;
|
||||
|
||||
buffer->out_string[buffer->out_pos-1].gindex = glyph_index;
|
||||
buffer->in_pos++;
|
||||
buffer->out_pos++;
|
||||
buffer->out_length = buffer->out_pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -375,9 +376,5 @@ _hb_buffer_replace_output_glyph( HB_Buffer buffer,
|
|||
HB_INTERNAL HB_UShort
|
||||
_hb_buffer_allocate_ligid( HB_Buffer buffer )
|
||||
{
|
||||
buffer->max_ligID++;
|
||||
if (HB_UNLIKELY (buffer->max_ligID == 0))
|
||||
buffer->max_ligID++;
|
||||
|
||||
return buffer->max_ligID;
|
||||
return ++buffer->max_ligID;
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ static HB_Error Lookup_SingleSubst( HB_GSUBHeader* gsub,
|
|||
{
|
||||
case 1:
|
||||
value = (IN_CURGLYPH() + ss->ssf.ssf1.DeltaGlyphID ) & 0xFFFF;
|
||||
if ( REPLACE_Glyph( buffer, value, nesting_level ) )
|
||||
if ( REPLACE_Glyph( buffer, value ) )
|
||||
return error;
|
||||
break;
|
||||
|
||||
|
@ -289,7 +289,7 @@ static HB_Error Lookup_SingleSubst( HB_GSUBHeader* gsub,
|
|||
if ( index >= ss->ssf.ssf2.GlyphCount )
|
||||
return ERR(HB_Err_Invalid_SubTable);
|
||||
value = ss->ssf.ssf2.Substitute[index];
|
||||
if ( REPLACE_Glyph( buffer, value, nesting_level ) )
|
||||
if ( REPLACE_Glyph( buffer, value ) )
|
||||
return error;
|
||||
break;
|
||||
|
||||
|
@ -687,7 +687,7 @@ static HB_Error Lookup_AlternateSubst( HB_GSUBHeader* gsub,
|
|||
alt_index = 0;
|
||||
|
||||
value = aset.Alternate[alt_index];
|
||||
if ( REPLACE_Glyph( buffer, value, nesting_level ) )
|
||||
if ( REPLACE_Glyph( buffer, value ) )
|
||||
return error;
|
||||
|
||||
if ( _hb_ot_layout_has_new_glyph_classes (layout) )
|
||||
|
|
|
@ -127,7 +127,7 @@ struct SingleSubst {
|
|||
if (!single_substitute (glyph_id))
|
||||
return false;
|
||||
|
||||
_hb_buffer_replace_output_glyph (buffer, glyph_id, context_length == NO_CONTEXT);
|
||||
_hb_buffer_replace_glyph (buffer, glyph_id);
|
||||
|
||||
if ( _hb_ot_layout_has_new_glyph_classes (layout) )
|
||||
{
|
||||
|
@ -276,7 +276,7 @@ struct AlternateSubstFormat1 {
|
|||
|
||||
glyph_id = alt_set[alt_index];
|
||||
|
||||
_hb_buffer_replace_output_glyph (buffer, glyph_id, context_length == NO_CONTEXT);
|
||||
_hb_buffer_replace_glyph (buffer, glyph_id);
|
||||
|
||||
if ( _hb_ot_layout_has_new_glyph_classes (layout) )
|
||||
{
|
||||
|
@ -549,7 +549,7 @@ struct SubRule {
|
|||
{
|
||||
no_subst:
|
||||
/* No substitution for this index */
|
||||
_hb_buffer_copy_output_glyph (buffer);
|
||||
_hb_buffer_next_glyph (buffer);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ struct SubClassRule {
|
|||
{
|
||||
no_subst:
|
||||
/* No substitution for this index */
|
||||
_hb_buffer_copy_output_glyph (buffer);
|
||||
_hb_buffer_next_glyph (buffer);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -820,7 +820,7 @@ struct ContextSubstFormat3 {
|
|||
{
|
||||
no_subst:
|
||||
/* No substitution for this index */
|
||||
_hb_buffer_copy_output_glyph (buffer);
|
||||
_hb_buffer_next_glyph (buffer);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -1246,7 +1246,7 @@ struct SubstLookup : Lookup {
|
|||
substitute_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
|
||||
ret = true;
|
||||
else
|
||||
_hb_buffer_copy_output_glyph (buffer);
|
||||
_hb_buffer_next_glyph (buffer);
|
||||
|
||||
}
|
||||
if (ret)
|
||||
|
|
Loading…
Reference in New Issue