diff --git a/src/hb-ot-layout-gdef-private.h b/src/hb-ot-layout-gdef-private.h index d5dac9dc1..a463a41bb 100644 --- a/src/hb-ot-layout-gdef-private.h +++ b/src/hb-ot-layout-gdef-private.h @@ -213,6 +213,39 @@ struct LigCaretList }; ASSERT_SIZE (LigCaretList, 4); + +struct MarkGlyphSetsFormat1 +{ + inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const + { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; } + + private: + USHORT format; /* Format identifier--format = 1 */ + LongOffsetArrayOf + coverage; /* Array of long offsets to mark set + * coverage tables */ +}; +ASSERT_SIZE (MarkGlyphSetsFormat1, 4); + +struct MarkGlyphSets +{ + inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const + { + switch (u.format) { + case 1: return u.format1->covers (set_index, glyph_id); + default:return false; + } + } + + private: + union { + USHORT format; /* Format identifier */ + MarkGlyphSetsFormat1 format1[]; + } u; +}; +ASSERT_SIZE (MarkGlyphSets, 2); + + /* * GDEF */ @@ -232,18 +265,15 @@ struct GDEF STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION (GDEF, 1); inline bool has_glyph_classes () const { return glyphClassDef != 0; } - inline hb_ot_layout_class_t get_glyph_class (hb_ot_layout_t *layout, - hb_codepoint_t glyph) const + inline hb_ot_layout_class_t get_glyph_class (hb_codepoint_t glyph) const { return (this+glyphClassDef).get_class (glyph); } inline bool has_mark_attachment_types () const { return markAttachClassDef != 0; } - inline hb_ot_layout_class_t get_mark_attachment_type (hb_ot_layout_t *layout, - hb_codepoint_t glyph) const + inline hb_ot_layout_class_t get_mark_attachment_type (hb_codepoint_t glyph) const { return (this+markAttachClassDef).get_class (glyph); } inline bool has_attach_points () const { return attachList != 0; } - inline bool get_attach_points (hb_ot_layout_t *layout, - hb_codepoint_t glyph_id, + inline bool get_attach_points (hb_codepoint_t glyph_id, unsigned int *point_count /* IN/OUT */, unsigned int *point_array /* OUT */) const { return (this+attachList).get_attach_points (glyph_id, point_count, point_array); } @@ -255,9 +285,13 @@ struct GDEF int *caret_array /* OUT */) const { return (this+ligCaretList).get_lig_carets (layout, glyph_id, caret_count, caret_array); } + inline bool has_mark_sets () const { return version >= 0x00010002 && markGlyphSetsDef[0] != 0; } + inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const + { return version >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); } + private: - FixedVersion version; /* Version of the GDEF table--initially - * 0x00010000 */ + FixedVersion version; /* Version of the GDEF table--currently + * 0x00010002 */ OffsetTo glyphClassDef; /* Offset to class definition table * for glyph type--from beginning of @@ -274,6 +308,11 @@ struct GDEF markAttachClassDef; /* Offset to class definition table for * mark attachment type--from beginning * of GDEF header (may be Null) */ + OffsetTo + markGlyphSetsDef[0]; /* Offset to the table of mark set + * definitions--from beginning of GDEF + * header (may be NULL). Introduced + * in version 00010002. */ }; ASSERT_SIZE (GDEF, 12); diff --git a/src/hb-ot-layout-gpos-private.h b/src/hb-ot-layout-gpos-private.h index 2c4b741d4..ed61eef93 100644 --- a/src/hb-ot-layout-gpos-private.h +++ b/src/hb-ot-layout-gpos-private.h @@ -48,6 +48,7 @@ struct ValueFormat : USHORT yPlaDevice = 0x0020, /* Includes vertical Device table for placement */ xAdvDevice = 0x0040, /* Includes horizontal Device table for advance */ yAdvDevice = 0x0080, /* Includes vertical Device table for advance */ + ignored = 0x0F00, /* Was used in TrueType Open for MM fonts */ reserved = 0xF000, /* For future use */ }; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 8f53d4659..a1adb2f06 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -140,11 +140,11 @@ _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout, /* TODO old harfbuzz doesn't always parse mark attachments as it says it was * introduced without a version bump, so it may not be safe */ - klass = layout->gdef->get_mark_attachment_type (layout, glyph); + klass = layout->gdef->get_mark_attachment_type (glyph); if (klass) return klass << 8; - klass = layout->gdef->get_glyph_class (layout, glyph); + klass = layout->gdef->get_glyph_class (glyph); if (!klass && glyph < layout->new_gdef.len) klass = layout->new_gdef.klasses[glyph]; @@ -308,7 +308,7 @@ hb_ot_layout_get_attach_points (hb_ot_layout_t *layout, unsigned int *point_count /* IN/OUT */, unsigned int *point_array /* OUT */) { - return layout->gdef->get_attach_points (layout, glyph, point_count, point_array); + return layout->gdef->get_attach_points (glyph, point_count, point_array); } hb_bool_t