summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexei Podtelezhnikov <apodtele@gmail.com>2023-02-25 21:54:21 -0500
committerAlexei Podtelezhnikov <apodtele@gmail.com>2023-02-25 21:54:21 -0500
commit6423ddb8a077c44ddf90e6b149c308a801a7bb78 (patch)
tree1f3713bacfc27488e38cb2b3775fdbfcdc5b0196
parent74c498a383ed1162d37c18f74cceb6db38916f14 (diff)
downloadfreetype2-6423ddb8a077c44ddf90e6b149c308a801a7bb78.tar.gz
* 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.
-rw-r--r--src/cff/cffload.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 4b8c6e16c..be5fce21b 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -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 */