[>64k:layout] Templatize GDEFVersion1

This commit is contained in:
Behdad Esfahbod 2022-07-19 14:35:58 -06:00
parent 1665cf6bc4
commit 8080e01afc
1 changed files with 10 additions and 10 deletions

View File

@ -510,30 +510,31 @@ struct MarkGlyphSets
*/ */
struct GDEFVersion1 template <typename Types>
struct GDEFVersion1_2
{ {
friend struct GDEF; friend struct GDEF;
protected: protected:
FixedVersion<>version; /* Version of the GDEF table--currently FixedVersion<>version; /* Version of the GDEF table--currently
* 0x00010003u */ * 0x00010003u */
Offset16To<ClassDef> typename Types::template OffsetTo<ClassDef>
glyphClassDef; /* Offset to class definition table glyphClassDef; /* Offset to class definition table
* for glyph type--from beginning of * for glyph type--from beginning of
* GDEF header (may be Null) */ * GDEF header (may be Null) */
Offset16To<AttachList> typename Types::template OffsetTo<AttachList>
attachList; /* Offset to list of glyphs with attachList; /* Offset to list of glyphs with
* attachment points--from beginning * attachment points--from beginning
* of GDEF header (may be Null) */ * of GDEF header (may be Null) */
Offset16To<LigCaretList> typename Types::template OffsetTo<LigCaretList>
ligCaretList; /* Offset to list of positioning points ligCaretList; /* Offset to list of positioning points
* for ligature carets--from beginning * for ligature carets--from beginning
* of GDEF header (may be Null) */ * of GDEF header (may be Null) */
Offset16To<ClassDef> typename Types::template OffsetTo<ClassDef>
markAttachClassDef; /* Offset to class definition table for markAttachClassDef; /* Offset to class definition table for
* mark attachment type--from beginning * mark attachment type--from beginning
* of GDEF header (may be Null) */ * of GDEF header (may be Null) */
Offset16To<MarkGlyphSets> typename Types::template OffsetTo<MarkGlyphSets>
markGlyphSetsDef; /* Offset to the table of mark set markGlyphSetsDef; /* Offset to the table of mark set
* definitions--from beginning of GDEF * definitions--from beginning of GDEF
* header (may be NULL). Introduced * header (may be NULL). Introduced
@ -544,7 +545,7 @@ struct GDEFVersion1
* header (may be NULL). Introduced * header (may be NULL). Introduced
* in version 0x00010003. */ * in version 0x00010003. */
public: public:
DEFINE_SIZE_MIN (12); DEFINE_SIZE_MIN (4 + 4 * Types::size);
unsigned int get_size () const unsigned int get_size () const
{ {
@ -557,7 +558,6 @@ struct GDEFVersion1
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (version.sanitize (c) && return_trace (version.sanitize (c) &&
likely (version.major == 1) &&
glyphClassDef.sanitize (c, this) && glyphClassDef.sanitize (c, this) &&
attachList.sanitize (c, this) && attachList.sanitize (c, this) &&
ligCaretList.sanitize (c, this) && ligCaretList.sanitize (c, this) &&
@ -827,8 +827,8 @@ struct GDEF
protected: protected:
union { union {
FixedVersion<> version; /* Version identifier */ FixedVersion<> version; /* Version identifier */
GDEFVersion1 version1; GDEFVersion1_2<SmallTypes> version1;
} u; } u;
public: public:
DEFINE_SIZE_MIN (4); DEFINE_SIZE_MIN (4);