diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 8e7b7b529..e70ce9717 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -30,6 +30,9 @@ #include "hb-aat-layout.hh" #include "hb-open-type.hh" +namespace OT { +struct GDEF; +}; namespace AAT { @@ -863,6 +866,7 @@ struct hb_aat_apply_context_t : hb_buffer_t *buffer; hb_sanitize_context_t sanitizer; const ankr *ankr_table; + const OT::GDEF *gdef_table; /* Unused. For debug tracing only. */ unsigned int lookup_index; diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index dea69c9ab..a807bdcfc 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -30,6 +30,7 @@ #include "hb-open-type.hh" #include "hb-aat-layout-common.hh" #include "hb-ot-layout-common.hh" +#include "hb-ot-layout-gdef-table.hh" #include "hb-aat-map.hh" /* @@ -215,7 +216,9 @@ struct ContextualSubtable hb_aat_apply_context_t *c_) : ret (false), c (c_), + gdef (*c->gdef_table), mark_set (false), + has_glyph_classes (gdef.has_glyph_classes ()), mark (0), table (table_), subs (table+table->substitutionTables) {} @@ -263,6 +266,9 @@ struct ContextualSubtable { buffer->unsafe_to_break (mark, hb_min (buffer->idx + 1, buffer->len)); buffer->info[mark].codepoint = *replacement; + if (has_glyph_classes) + _hb_glyph_info_set_glyph_props (&buffer->info[mark], + gdef.get_glyph_props (*replacement)); ret = true; } @@ -287,6 +293,9 @@ struct ContextualSubtable if (replacement) { buffer->info[idx].codepoint = *replacement; + if (has_glyph_classes) + _hb_glyph_info_set_glyph_props (&buffer->info[idx], + gdef.get_glyph_props (*replacement)); ret = true; } @@ -301,7 +310,9 @@ struct ContextualSubtable bool ret; private: hb_aat_apply_context_t *c; + const OT::GDEF &gdef; bool mark_set; + bool has_glyph_classes; unsigned int mark; const ContextualSubtable *table; const UnsizedListOfOffset16To, HBUINT, false> &subs; @@ -599,6 +610,9 @@ struct NoncontextualSubtable { TRACE_APPLY (this); + const OT::GDEF &gdef (*c->gdef_table); + bool has_glyph_classes = gdef.has_glyph_classes (); + bool ret = false; unsigned int num_glyphs = c->face->get_num_glyphs (); @@ -610,6 +624,9 @@ struct NoncontextualSubtable if (replacement) { info[i].codepoint = *replacement; + if (has_glyph_classes) + _hb_glyph_info_set_glyph_props (&info[i], + gdef.get_glyph_props (*replacement)); ret = true; } } diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 0e9f2b495..63f602855 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -55,6 +55,7 @@ AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *p buffer (buffer_), sanitizer (), ankr_table (&Null (AAT::ankr)), + gdef_table (face->table.GDEF->table), lookup_index (0) { sanitizer.init (blob); @@ -79,7 +80,7 @@ AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_) * @short_description: Apple Advanced Typography Layout * @include: hb-aat.h * - * Functions for querying AAT Layout features in the font face. + * Functions for querying AAT Layout features in the font face. * * HarfBuzz supports all of the AAT tables used to implement shaping. Other * AAT tables and their associated features are not supported. @@ -172,13 +173,13 @@ static const hb_aat_feature_mapping_t feature_mappings[] = {HB_TAG ('z','e','r','o'), HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS, HB_AAT_LAYOUT_FEATURE_SELECTOR_SLASHED_ZERO_ON, HB_AAT_LAYOUT_FEATURE_SELECTOR_SLASHED_ZERO_OFF}, }; -/** +/** * hb_aat_layout_find_feature_mapping: * @tag: The requested #hb_tag_t feature tag * * Fetches the AAT feature-and-selector combination that corresponds * to a given OpenType feature tag. - * + * * Return value: the AAT features and selectors corresponding to the * OpenType feature tag queried *