* src/cff/cffload.c (cff_encoding_load): Optimize array zeroing.

This is unnecessary for predefined standard and expert encodings.
Even for custom encodings the arrays might be already zeroed when
CFF_FontRec is created but we keep it just in case.
This commit is contained in:
Alexei Podtelezhnikov 2023-02-25 21:54:21 -05:00
parent 74c498a383
commit 6423ddb8a0
1 changed files with 4 additions and 7 deletions

View File

@ -1650,13 +1650,6 @@
goto Exit;
}
/* Zero out the code to gid/sid mappings. */
for ( j = 0; j < 256; j++ )
{
encoding->sids [j] = 0;
encoding->codes[j] = 0;
}
/* Note: The encoding table in a CFF font is indexed by glyph index; */
/* the first encoded glyph index is 1. Hence, we read the character */
/* code (`glyph_code') at index j and make the assignment: */
@ -1671,6 +1664,10 @@
if ( offset > 1 )
{
/* Zero out the code to gid/sid mappings. */
FT_ARRAY_ZERO( encoding->sids, 256 );
FT_ARRAY_ZERO( encoding->codes, 256 );
encoding->offset = base_offset + offset;
/* we need to parse the table to determine its size */