[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
This commit is contained in:
Behdad Esfahbod 2022-07-17 21:32:27 -06:00
parent d8574b44cc
commit 2124ad8906
2 changed files with 11 additions and 2 deletions

View File

@ -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;

View File

@ -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<feature_info_t> features;