Skip to content

Commit

Permalink
[>64k:layout:GDEF] Implement version 2
Browse files Browse the repository at this point in the history
Implements harfbuzz/boring-expansion-spec#36

Subset does NOT lower format.
  • Loading branch information
behdad committed Jul 19, 2022
1 parent 8080e01 commit 8737dea
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/hb-ot-layout-gdef-table.hh
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ struct GDEF
{
switch (u.version.major) {
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;
}
}
Expand All @@ -631,6 +634,9 @@ struct GDEF
if (unlikely (!u.version.sanitize (c))) return_trace (false);
switch (u.version.major) {
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);
}
}
Expand All @@ -639,6 +645,9 @@ struct GDEF
{
switch (u.version.major) {
case 1: return u.version1.subset (c);
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.subset (c);
#endif
default: return false;
}
}
Expand All @@ -647,83 +656,119 @@ struct GDEF
{
switch (u.version.major) {
case 1: return u.version1.glyphClassDef != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.glyphClassDef != 0;
#endif
default: return false;
}
}
const ClassDef &get_glyph_class_def () const
{
switch (u.version.major) {
case 1: return this+u.version1.glyphClassDef;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.glyphClassDef;
#endif
default: return Null(ClassDef);
}
}
bool has_attach_list () const
{
switch (u.version.major) {
case 1: return u.version1.attachList != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.attachList != 0;
#endif
default: return false;
}
}
const AttachList &get_attach_list () const
{
switch (u.version.major) {
case 1: return this+u.version1.attachList;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.attachList;
#endif
default: return Null(AttachList);
}
}
bool has_lig_carets () const
{
switch (u.version.major) {
case 1: return u.version1.ligCaretList != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.ligCaretList != 0;
#endif
default: return false;
}
}
const LigCaretList &get_lig_caret_list () const
{
switch (u.version.major) {
case 1: return this+u.version1.ligCaretList;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.ligCaretList;
#endif
default: return Null(LigCaretList);
}
}
bool has_mark_attachment_types () const
{
switch (u.version.major) {
case 1: return u.version1.markAttachClassDef != 0;
#ifndef HB_NO_BORING_EXPANSION
case 2: return u.version2.markAttachClassDef != 0;
#endif
default: return false;
}
}
const ClassDef &get_mark_attach_class_def () const
{
switch (u.version.major) {
case 1: return this+u.version1.markAttachClassDef;
#ifndef HB_NO_BORING_EXPANSION
case 2: return this+u.version2.markAttachClassDef;
#endif
default: return Null(ClassDef);
}
}
bool has_mark_glyph_sets () const
{
switch (u.version.major) {
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;
}
}
const MarkGlyphSets &get_mark_glyph_sets () const
{
switch (u.version.major) {
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);
}
}
bool has_var_store () const
{
switch (u.version.major) {
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;
}
}
const VariationStore &get_var_store () const
{
switch (u.version.major) {
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);
}
}
Expand Down Expand Up @@ -829,6 +874,9 @@ struct GDEF
union {
FixedVersion<> version; /* Version identifier */
GDEFVersion1_2<SmallTypes> version1;
#ifndef HB_NO_BORING_EXPANSION
GDEFVersion1_2<MediumTypes> version2;
#endif
} u;
public:
DEFINE_SIZE_MIN (4);
Expand Down

0 comments on commit 8737dea

Please sign in to comment.