From 2124ad8906bb77eee099071dccc49d3c60fe331f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 17 Jul 2022 21:32:27 -0600 Subject: [PATCH] [aat/morx] Implement language-specific forms Test on Mac with, eg. $ hb-view /Library/Fonts/BigCaslon.ttf -u 107 vs $ hb-view /Library/Fonts/BigCaslon.ttf -u 107 --language pl Fixes https://github.com/harfbuzz/harfbuzz/issues/1373 --- src/hb-aat-layout-morx-table.hh | 7 +++++++ src/hb-aat-map.hh | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 3d053cb13..73ab5204a 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -980,6 +980,13 @@ struct Chain setting = HB_AAT_LAYOUT_FEATURE_SELECTOR_LOWER_CASE_SMALL_CAPS; goto retry; } + else if (type == HB_AAT_LAYOUT_FEATURE_TYPE_LANGUAGE_TAG_TYPE && setting && + /* TODO: Rudimentary language matching. */ + map->face->table.ltag->get_language (setting - 1) == map->props.language) + { + flags &= feature.disableFlags; + flags |= feature.enableFlags; + } } } return flags; diff --git a/src/hb-aat-map.hh b/src/hb-aat-map.hh index 5a0fa7054..976a2cda2 100644 --- a/src/hb-aat-map.hh +++ b/src/hb-aat-map.hh @@ -52,8 +52,9 @@ struct hb_aat_map_builder_t public: HB_INTERNAL hb_aat_map_builder_t (hb_face_t *face_, - const hb_segment_properties_t *props_ HB_UNUSED) : - face (face_) {} + const hb_segment_properties_t *props_) : + face (face_), + props (*props_) {} HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value=1); @@ -87,6 +88,7 @@ struct hb_aat_map_builder_t public: hb_face_t *face; + hb_segment_properties_t props; public: hb_sorted_vector_t features;