[woff2] Get known tags from function.
Change `KnownTags' to a function (`woff2_known_tags'). This avoids introducing a global constant array. This function returns the specified index without *any* checks. The caller must ensure that `index' is within array limits. * src/sfnt/sfwoff2.c (woff2_open_font): Change `KnownTags[...]' notation to `woff2_known_tags( ... )'. * src/sfnt/woff2tags.c: Perform changes. * src/sfnt/woff2tags.h: Update definitions.
This commit is contained in:
parent
c6c2c0b574
commit
7a1639bc1e
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2019-08-27 Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>
|
||||
|
||||
[woff2] Get known tags from function.
|
||||
|
||||
Change `KnownTags' to a function (`woff2_known_tags'). This avoids
|
||||
introducing a global constant array. This function returns the
|
||||
specified index without *any* checks. The caller must ensure that
|
||||
`index' is within array limits.
|
||||
|
||||
* src/sfnt/sfwoff2.c (woff2_open_font): Change `KnownTags[...]'
|
||||
notation to `woff2_known_tags( ... )'.
|
||||
|
||||
* src/sfnt/woff2tags.c: Perform changes.
|
||||
|
||||
* src/sfnt/woff2tags.h: Update definitions.
|
||||
|
||||
2019-08-27 Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>
|
||||
|
||||
[woff2] Minor.
|
||||
|
|
|
@ -360,7 +360,7 @@
|
|||
goto Exit;
|
||||
}
|
||||
else
|
||||
table->Tag = KnownTags[table->FlagByte & 0x3f];
|
||||
table->Tag = woff2_known_tags( table->FlagByte & 0x3f );
|
||||
|
||||
flags = 0;
|
||||
xform_version = ( table->FlagByte >> 6 ) & 0x03;
|
||||
|
|
|
@ -19,8 +19,12 @@
|
|||
#include "sfwoff.h"
|
||||
#include FT_TRUETYPE_TAGS_H
|
||||
|
||||
/* Known table tags in the order given in WOFF2 specification. */
|
||||
const FT_ULong KnownTags[63] = {
|
||||
/* Return tag from index in the order given in WOFF2 specification. */
|
||||
FT_LOCAL_DEF( FT_ULong )
|
||||
woff2_known_tags( FT_Byte index )
|
||||
{
|
||||
const FT_ULong known_tags[63] =
|
||||
{
|
||||
FT_MAKE_TAG('c', 'm', 'a', 'p'), /* 0 */
|
||||
FT_MAKE_TAG('h', 'e', 'a', 'd'), /* 1 */
|
||||
FT_MAKE_TAG('h', 'h', 'e', 'a'), /* 2 */
|
||||
|
@ -84,7 +88,11 @@ const FT_ULong KnownTags[63] = {
|
|||
FT_MAKE_TAG('G', 'l', 'o', 'c'), /* 60 */
|
||||
FT_MAKE_TAG('F', 'e', 'a', 't'), /* 61 */
|
||||
FT_MAKE_TAG('S', 'i', 'l', 'l'), /* 62 */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
return known_tags[index];
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -27,14 +27,15 @@
|
|||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* Leave the first byte open to store flag_byte. */
|
||||
/* Leave the first byte open to store flag_byte. */
|
||||
#define WOFF2_FLAGS_TRANSFORM 1 << 8
|
||||
|
||||
#define WOFF2_SFNT_HEADER_SIZE 12
|
||||
#define WOFF2_SFNT_ENTRY_SIZE 16
|
||||
|
||||
/* Known table tags. */
|
||||
extern const FT_ULong KnownTags[];
|
||||
FT_LOCAL( FT_ULong )
|
||||
woff2_known_tags( FT_Byte index );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
Loading…
Reference in New Issue