[>64k:layout:GDEF] Implement version 2

Implements https://github.com/be-fonts/boring-expansion-spec/issues/36

Subset does NOT lower format.
This commit is contained in:
Behdad Esfahbod 2022-07-19 14:39:47 -06:00
parent 8080e01afc
commit 8737dea4d9
1 changed files with 48 additions and 0 deletions

View File

@ -621,6 +621,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version1.get_size (); case 1: return u.version1.get_size ();
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.get_size ();
#endif
default: return u.version.static_size; default: return u.version.static_size;
} }
} }
@ -631,6 +634,9 @@ struct GDEF
if (unlikely (!u.version.sanitize (c))) return_trace (false); if (unlikely (!u.version.sanitize (c))) return_trace (false);
switch (u.version.major) { switch (u.version.major) {
case 1: return_trace (u.version1.sanitize (c)); case 1: return_trace (u.version1.sanitize (c));
#ifndef HB_NO_BORING_EXPANSION
case 2: return_trace (u.version2.sanitize (c));
#endif
default: return_trace (true); default: return_trace (true);
} }
} }
@ -639,6 +645,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version1.subset (c); case 1: return u.version1.subset (c);
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.subset (c);
#endif
default: return false; default: return false;
} }
} }
@ -647,6 +656,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version1.glyphClassDef != 0; case 1: return u.version1.glyphClassDef != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.glyphClassDef != 0;
#endif
default: return false; default: return false;
} }
} }
@ -654,6 +666,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return this+u.version1.glyphClassDef; case 1: return this+u.version1.glyphClassDef;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.glyphClassDef;
#endif
default: return Null(ClassDef); default: return Null(ClassDef);
} }
} }
@ -661,6 +676,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version1.attachList != 0; case 1: return u.version1.attachList != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.attachList != 0;
#endif
default: return false; default: return false;
} }
} }
@ -668,6 +686,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return this+u.version1.attachList; case 1: return this+u.version1.attachList;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.attachList;
#endif
default: return Null(AttachList); default: return Null(AttachList);
} }
} }
@ -675,6 +696,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version1.ligCaretList != 0; case 1: return u.version1.ligCaretList != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.ligCaretList != 0;
#endif
default: return false; default: return false;
} }
} }
@ -682,6 +706,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return this+u.version1.ligCaretList; case 1: return this+u.version1.ligCaretList;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.ligCaretList;
#endif
default: return Null(LigCaretList); default: return Null(LigCaretList);
} }
} }
@ -689,6 +716,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version1.markAttachClassDef != 0; case 1: return u.version1.markAttachClassDef != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.markAttachClassDef != 0;
#endif
default: return false; default: return false;
} }
} }
@ -696,6 +726,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return this+u.version1.markAttachClassDef; case 1: return this+u.version1.markAttachClassDef;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.markAttachClassDef;
#endif
default: return Null(ClassDef); default: return Null(ClassDef);
} }
} }
@ -703,6 +736,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010002u && u.version1.markGlyphSetsDef != 0; case 1: return u.version.to_int () >= 0x00010002u && u.version1.markGlyphSetsDef != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.markGlyphSetsDef != 0;
#endif
default: return false; default: return false;
} }
} }
@ -710,6 +746,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010002u ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets); case 1: return u.version.to_int () >= 0x00010002u ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets);
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.markGlyphSetsDef;
#endif
default: return Null(MarkGlyphSets); default: return Null(MarkGlyphSets);
} }
} }
@ -717,6 +756,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010003u && u.version1.varStore != 0; case 1: return u.version.to_int () >= 0x00010003u && u.version1.varStore != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.varStore != 0;
#endif
default: return false; default: return false;
} }
} }
@ -724,6 +766,9 @@ struct GDEF
{ {
switch (u.version.major) { switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010003u ? this+u.version1.varStore : Null(VariationStore); case 1: return u.version.to_int () >= 0x00010003u ? this+u.version1.varStore : Null(VariationStore);
#ifndef HB_NO_BORING_EXPANSION
#endif
case 2: return this+u.version2.varStore;
default: return Null(VariationStore); default: return Null(VariationStore);
} }
} }
@ -829,6 +874,9 @@ struct GDEF
union { union {
FixedVersion<> version; /* Version identifier */ FixedVersion<> version; /* Version identifier */
GDEFVersion1_2<SmallTypes> version1; GDEFVersion1_2<SmallTypes> version1;
#ifndef HB_NO_BORING_EXPANSION
GDEFVersion1_2<MediumTypes> version2;
#endif
} u; } u;
public: public:
DEFINE_SIZE_MIN (4); DEFINE_SIZE_MIN (4);