Make FixedVersion a template
This commit is contained in:
parent
238b943e85
commit
9a13ed453e
|
@ -140,7 +140,7 @@ struct TTCHeaderVersion1
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
|
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 */
|
* 0x00010000u */
|
||||||
ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
|
ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
|
||||||
table; /* Array of offsets to the OffsetTable for each font
|
table; /* Array of offsets to the OffsetTable for each font
|
||||||
|
@ -187,7 +187,7 @@ struct TTCHeader
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
|
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 */
|
* 0x00010000u or 0x00020000u */
|
||||||
} header;
|
} header;
|
||||||
TTCHeaderVersion1 version1;
|
TTCHeaderVersion1 version1;
|
||||||
|
|
|
@ -739,9 +739,10 @@ struct CheckSum : ULONG
|
||||||
* Version Numbers
|
* Version Numbers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
template <typename FixedType=USHORT>
|
||||||
struct FixedVersion
|
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
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
|
@ -749,10 +750,10 @@ struct FixedVersion
|
||||||
return_trace (c->check_struct (this));
|
return_trace (c->check_struct (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
USHORT major;
|
FixedType major;
|
||||||
USHORT minor;
|
FixedType minor;
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (4);
|
DEFINE_SIZE_STATIC (2 * sizeof(FixedType));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,9 @@ struct head
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FixedVersion version; /* Version of the head table--currently
|
FixedVersion<>version; /* Version of the head table--currently
|
||||||
* 0x00010000u for version 1.0. */
|
* 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
|
ULONG checkSumAdjustment; /* To compute: set it to 0, sum the
|
||||||
* entire font as ULONG, then store
|
* entire font as ULONG, then store
|
||||||
* 0xB1B0AFBAu - sum. */
|
* 0xB1B0AFBAu - sum. */
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct _hea
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FixedVersion version; /* 0x00010000u for version 1.0. */
|
FixedVersion<>version; /* 0x00010000u for version 1.0. */
|
||||||
FWORD ascender; /* Typographic ascent. */
|
FWORD ascender; /* Typographic ascent. */
|
||||||
FWORD descender; /* Typographic descent. */
|
FWORD descender; /* Typographic descent. */
|
||||||
FWORD lineGap; /* Typographic line gap. */
|
FWORD lineGap; /* Typographic line gap. */
|
||||||
|
|
|
@ -409,7 +409,7 @@ struct GDEF
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FixedVersion version; /* Version of the GDEF table--currently
|
FixedVersion<>version; /* Version of the GDEF table--currently
|
||||||
* 0x00010002u */
|
* 0x00010002u */
|
||||||
OffsetTo<ClassDef>
|
OffsetTo<ClassDef>
|
||||||
glyphClassDef; /* Offset to class definition table
|
glyphClassDef; /* Offset to class definition table
|
||||||
|
|
|
@ -2277,7 +2277,7 @@ struct GSUBGPOS
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FixedVersion version; /* Version of the GSUB/GPOS table--initially set
|
FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set
|
||||||
* to 0x00010000u */
|
* to 0x00010000u */
|
||||||
OffsetTo<ScriptList>
|
OffsetTo<ScriptList>
|
||||||
scriptList; /* ScriptList table */
|
scriptList; /* ScriptList table */
|
||||||
|
|
|
@ -218,7 +218,7 @@ struct JSTF
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FixedVersion version; /* Version of the JSTF table--initially set
|
FixedVersion<>version; /* Version of the JSTF table--initially set
|
||||||
* to 0x00010000u */
|
* to 0x00010000u */
|
||||||
RecordArrayOf<JstfScript>
|
RecordArrayOf<JstfScript>
|
||||||
scriptList; /* Array of JstfScripts--listed
|
scriptList; /* Array of JstfScripts--listed
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct maxp
|
||||||
|
|
||||||
/* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
|
/* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
|
||||||
protected:
|
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. */
|
* 0x00005000u or 0x00010000u. */
|
||||||
USHORT numGlyphs; /* The number of glyphs in the font. */
|
USHORT numGlyphs; /* The number of glyphs in the font. */
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue