[arabic] Pause after calt only if no rclt

Fixes https://github.com/harfbuzz/harfbuzz/issues/1573
This commit is contained in:
Behdad Esfahbod 2022-07-14 11:20:00 -06:00
parent 8b379ddc76
commit d68507d062
3 changed files with 24 additions and 7 deletions

View File

@ -109,6 +109,21 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag,
info->stage[1] = current_stage[1];
}
bool hb_ot_map_builder_t::has_feature (hb_tag_t tag)
{
for (unsigned int table_index = 0; table_index < 2; table_index++)
{
if (hb_ot_layout_language_find_feature (face,
table_tags[table_index],
script_index[table_index],
language_index[table_index],
tag,
nullptr))
return true;
}
return false;
}
void
hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m,
unsigned int table_index,

View File

@ -212,6 +212,8 @@ struct hb_ot_map_builder_t
hb_ot_map_feature_flags_t flags=F_NONE,
unsigned int value=1);
HB_INTERNAL bool has_feature (hb_tag_t tag);
void add_feature (const hb_ot_map_feature_t &feat)
{ add_feature (feat.tag, feat.flags); }

View File

@ -201,9 +201,6 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
* work. However, testing shows that rlig and calt are applied
* together for Mongolian in Uniscribe. As such, we only add a
* pause for Arabic, not other scripts.
*
* A pause after calt is required to make KFGQPC Uthmanic Script HAFS
* work correctly. See https://github.com/harfbuzz/harfbuzz/issues/505
*/
@ -232,10 +229,13 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
if (plan->props.script == HB_SCRIPT_ARABIC)
map->add_gsub_pause (arabic_fallback_shape);
/* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */
map->enable_feature (HB_TAG('r','c','l','t'), F_MANUAL_ZWJ);
map->enable_feature (HB_TAG('c','a','l','t'), F_MANUAL_ZWJ);
map->add_gsub_pause (nullptr);
map->enable_feature (HB_TAG('c','a','l','t'), F_MANUAL_ZWJ);
/* https://github.com/harfbuzz/harfbuzz/issues/1573 */
if (!map->has_feature (HB_TAG('r','c','l','t')))
{
map->add_gsub_pause (nullptr);
map->enable_feature (HB_TAG('r','c','l','t'), F_MANUAL_ZWJ);
}
/* The spec includes 'cswh'. Earlier versions of Windows
* used to enable this by default, but testing suggests