Make FixedVersion a template

This commit is contained in:
Behdad Esfahbod 2016-02-22 11:44:45 +09:00
parent 238b943e85
commit 9a13ed453e
8 changed files with 14 additions and 13 deletions

View File

@ -140,7 +140,7 @@ struct TTCHeaderVersion1
protected:
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
FixedVersion version; /* Version of the TTC Header (1.0),
FixedVersion<>version; /* Version of the TTC Header (1.0),
* 0x00010000u */
ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
table; /* Array of offsets to the OffsetTable for each font
@ -187,7 +187,7 @@ struct TTCHeader
union {
struct {
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
FixedVersion version; /* Version of the TTC Header (1.0 or 2.0),
FixedVersion<>version; /* Version of the TTC Header (1.0 or 2.0),
* 0x00010000u or 0x00020000u */
} header;
TTCHeaderVersion1 version1;

View File

@ -739,9 +739,10 @@ struct CheckSum : ULONG
* Version Numbers
*/
template <typename FixedType=USHORT>
struct FixedVersion
{
inline uint32_t to_int (void) const { return (major << 16) + minor; }
inline uint32_t to_int (void) const { return (major << sizeof(FixedType)) + minor; }
inline bool sanitize (hb_sanitize_context_t *c) const
{
@ -749,10 +750,10 @@ struct FixedVersion
return_trace (c->check_struct (this));
}
USHORT major;
USHORT minor;
FixedType major;
FixedType minor;
public:
DEFINE_SIZE_STATIC (4);
DEFINE_SIZE_STATIC (2 * sizeof(FixedType));
};

View File

@ -61,9 +61,9 @@ struct head
}
protected:
FixedVersion version; /* Version of the head table--currently
FixedVersion<>version; /* Version of the head table--currently
* 0x00010000u for version 1.0. */
FixedVersion fontRevision; /* Set by font manufacturer. */
FixedVersion<>fontRevision; /* Set by font manufacturer. */
ULONG checkSumAdjustment; /* To compute: set it to 0, sum the
* entire font as ULONG, then store
* 0xB1B0AFBAu - sum. */

View File

@ -56,7 +56,7 @@ struct _hea
}
public:
FixedVersion version; /* 0x00010000u for version 1.0. */
FixedVersion<>version; /* 0x00010000u for version 1.0. */
FWORD ascender; /* Typographic ascent. */
FWORD descender; /* Typographic descent. */
FWORD lineGap; /* Typographic line gap. */

View File

@ -409,7 +409,7 @@ struct GDEF
protected:
FixedVersion version; /* Version of the GDEF table--currently
FixedVersion<>version; /* Version of the GDEF table--currently
* 0x00010002u */
OffsetTo<ClassDef>
glyphClassDef; /* Offset to class definition table

View File

@ -2277,7 +2277,7 @@ struct GSUBGPOS
}
protected:
FixedVersion version; /* Version of the GSUB/GPOS table--initially set
FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set
* to 0x00010000u */
OffsetTo<ScriptList>
scriptList; /* ScriptList table */

View File

@ -218,7 +218,7 @@ struct JSTF
}
protected:
FixedVersion version; /* Version of the JSTF table--initially set
FixedVersion<>version; /* Version of the JSTF table--initially set
* to 0x00010000u */
RecordArrayOf<JstfScript>
scriptList; /* Array of JstfScripts--listed

View File

@ -58,7 +58,7 @@ struct maxp
/* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
protected:
FixedVersion version; /* Version of the maxp table (0.5 or 1.0),
FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
* 0x00005000u or 0x00010000u. */
USHORT numGlyphs; /* The number of glyphs in the font. */
public: