[woff2] Optimize table tagging.

Fixes #1107.

* include/freetype/internal/wofftypes.h (WOFF2_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff2.c (compare_tags, find_table, woff2_open_font):
Use 32-bit tag.
* src/sfnt/woff2tags.[ch] (woff2_known_tags): Use static storage and
return 32-bit tag.
This commit is contained in:
Alexei Podtelezhnikov 2021-10-27 22:24:27 -04:00
parent 80b13f5732
commit a577bbcb5b
4 changed files with 8 additions and 8 deletions

View File

@ -191,7 +191,7 @@ FT_BEGIN_HEADER
typedef struct WOFF2_TableRec_
{
FT_Byte FlagByte; /* table type and flags */
FT_ULong Tag; /* table file offset */
FT_Tag Tag; /* table file offset */
FT_ULong dst_length; /* uncompressed table length */
FT_ULong TransformLength; /* transformed length */

View File

@ -108,8 +108,8 @@
WOFF2_Table table1 = *(WOFF2_Table*)a;
WOFF2_Table table2 = *(WOFF2_Table*)b;
FT_ULong tag1 = table1->Tag;
FT_ULong tag2 = table2->Tag;
FT_Tag tag1 = table1->Tag;
FT_Tag tag2 = table2->Tag;
if ( tag1 > tag2 )
@ -356,7 +356,7 @@
static WOFF2_Table
find_table( WOFF2_Table* tables,
FT_UShort num_tables,
FT_ULong tag )
FT_Tag tag )
{
FT_Int i;
@ -2216,7 +2216,7 @@
/* reject fonts that have multiple tables with the same tag */
for ( nn = 1; nn < woff2.num_tables; nn++ )
{
FT_ULong tag = indices[nn]->Tag;
FT_Tag tag = indices[nn]->Tag;
if ( tag == indices[nn - 1]->Tag )

View File

@ -28,10 +28,10 @@
*
* for details.
*/
FT_LOCAL_DEF( FT_ULong )
FT_LOCAL_DEF( FT_Tag )
woff2_known_tags( FT_Byte index )
{
const FT_ULong known_tags[63] =
static const FT_Tag known_tags[63] =
{
FT_MAKE_TAG('c', 'm', 'a', 'p'), /* 0 */
FT_MAKE_TAG('h', 'e', 'a', 'd'), /* 1 */

View File

@ -27,7 +27,7 @@
FT_BEGIN_HEADER
FT_LOCAL( FT_ULong )
FT_LOCAL( FT_Tag )
woff2_known_tags( FT_Byte index );