while (size > new_allocated)
new_allocated += (new_allocated >> 1) + 8;
- if ( REALLOC_ARRAY( buffer->positions, new_allocated, HB_PositionRec ) )
- return error;
+ if ( buffer->positions )
+ {
+ if ( REALLOC_ARRAY( buffer->positions, new_allocated, HB_PositionRec ) )
+ return error;
+ }
+
if ( REALLOC_ARRAY( buffer->in_string, new_allocated, HB_GlyphItemRec ) )
return error;
+
if ( buffer->inplace )
{
buffer->out_string = buffer->in_string;
return HB_Err_Ok;
}
+HB_Error
+hb_buffer_clear_positions( HB_Buffer buffer )
+{
+ if ( !buffer->positions )
+ {
+ HB_Error error;
+
+ if ( ALLOC_ARRAY( buffer->positions, buffer->allocated, HB_PositionRec ) )
+ return error;
+ }
+
+ memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length);
+
+ return HB_Err_Ok;
+}
+
void
hb_buffer_clear_output( HB_Buffer buffer )
{
hb_buffer_clear_output( HB_Buffer buffer );
HB_Error
+hb_buffer_clear_positions( HB_Buffer buffer );
+
+HB_Error
hb_buffer_add_glyph( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UInt properties,
{
HB_Error error, retError = HB_Err_Not_Covered;
GPOS_Instance gpi;
- FT_UShort i, j, lookup_count;
+ int i, j, lookup_count, num_features;
if ( !face || !gpos || !buffer )
return HB_Err_Invalid_Argument;
gpi.dvi = dvi;
lookup_count = gpos->LookupList.LookupCount;
+ num_features = gpos->FeatureList.ApplyCount;
- if ( gpos->FeatureList.ApplyCount )
+ if ( num_features )
{
- memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length);
+ error = hb_buffer_clear_positions( buffer );
+ if ( error )
+ return error;
}
- for ( i = 0; i < gpos->FeatureList.ApplyCount; i++ )
+ for ( i = 0; i < num_features; i++ )
{
FT_UShort feature_index = gpos->FeatureList.ApplyOrder[i];
HB_Feature feature = gpos->FeatureList.FeatureRecord[feature_index].Feature;
}
}
- if ( gpos->FeatureList.ApplyCount )
+ if ( num_features )
{
error = Position_CursiveChain ( buffer );
if ( error )
HB_Buffer buffer )
{
HB_Error error, retError = HB_Err_Not_Covered;
- FT_UShort i, j, lookup_count;
+ int i, j, lookup_count, num_features;
if ( !gsub ||
!buffer)
return retError;
lookup_count = gsub->LookupList.LookupCount;
+ num_features = gsub->FeatureList.ApplyCount;
- for ( i = 0; i < gsub->FeatureList.ApplyCount; i++)
+ for ( i = 0; i < num_features; i++)
{
FT_UShort feature_index = gsub->FeatureList.ApplyOrder[i];
HB_Feature feature = gsub->FeatureList.FeatureRecord[feature_index].Feature;