Add Offset16 and Offset32

This commit is contained in:
Behdad Esfahbod 2017-11-14 21:09:03 -08:00
parent 6f335ed1e5
commit c6173a392c
4 changed files with 8 additions and 5 deletions

View File

@ -705,7 +705,7 @@ struct Index : UINT16 {
DEFINE_NULL_DATA (Index, "\xff\xff");
/* Offset, Null offset = 0 */
template <typename Type=UINT16>
template <typename Type>
struct Offset : Type
{
inline bool is_null (void) const { return 0 == *this; }
@ -713,6 +713,9 @@ struct Offset : Type
DEFINE_SIZE_STATIC (sizeof(Type));
};
typedef Offset<UINT16> Offset16;
typedef Offset<UINT32> Offset32;
/* CheckSum */
struct CheckSum : UINT32

View File

@ -216,7 +216,7 @@ struct LangSys
return_trace (c->check_struct (this) && featureIndex.sanitize (c));
}
Offset<> lookupOrderZ; /* = Null (reserved for an offset to a
Offset16 lookupOrderZ; /* = Null (reserved for an offset to a
* reordering table) */
UINT16 reqFeatureIndex;/* Index of a feature required for this
* language system--if no required features
@ -662,7 +662,7 @@ struct Lookup
private:
UINT16 lookupType; /* Different enumerations for GSUB and GPOS */
UINT16 lookupFlag; /* Lookup qualifiers */
ArrayOf<Offset<> >
ArrayOf<Offset16>
subTable; /* Array of SubTables */
UINT16 markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets
* structure. This field is only present if bit

View File

@ -125,7 +125,7 @@ struct name
/* We only implement format 0 for now. */
UINT16 format; /* Format selector (=0/1). */
UINT16 count; /* Number of name records. */
Offset<> stringOffset; /* Offset to start of string storage (from start of table). */
Offset16 stringOffset; /* Offset to start of string storage (from start of table). */
NameRecord nameRecord[VAR]; /* The name records where count is the number of records. */
public:
DEFINE_SIZE_ARRAY (6, nameRecord);

View File

@ -186,7 +186,7 @@ struct fvar
protected:
FixedVersion<>version; /* Version of the fvar table
* initially set to 0x00010000u */
Offset<> things; /* Offset in bytes from the beginning of the table
Offset16 things; /* Offset in bytes from the beginning of the table
* to the start of the AxisRecord array. */
UINT16 reserved; /* This field is permanently reserved. Set to 2. */
UINT16 axisCount; /* The number of variation axes in the font (the