Prefer AAT shaping over OT if both available

Fixes https://github.com/harfbuzz/harfbuzz/issues/1529
This commit is contained in:
Behdad Esfahbod 2019-12-05 11:26:39 +00:00
parent 82545c5e2b
commit 0414341ac5
4 changed files with 2 additions and 46 deletions

View File

@ -69,7 +69,6 @@ _hb_options_init ()
if (0 == strncmp (c, name, p - c) && strlen (name) == static_cast<size_t>(p - c)) do { u.opts.symbol = true; } while (0)
OPTION ("uniscribe-bug-compatible", uniscribe_bug_compatible);
OPTION ("aat", aat);
#undef OPTION

View File

@ -46,7 +46,6 @@ struct hb_options_t
bool unused : 1; /* In-case sign bit is here. */
bool initialized : 1;
bool uniscribe_bug_compatible : 1;
bool aat : 1;
};
union hb_options_union_t {

View File

@ -399,27 +399,6 @@ OT::GSUB::is_blacklisted (hb_blob_t *blob HB_UNUSED,
#ifdef HB_NO_OT_LAYOUT_BLACKLIST
return false;
#endif
#ifndef HB_NO_AAT_SHAPE
/* Mac OS X prefers morx over GSUB. It also ships with various Indic fonts,
* all by 'MUTF' foundry (Tamil MN, Tamil Sangam MN, etc.), that have broken
* GSUB/GPOS tables. Some have GSUB with zero scripts, those are ignored by
* our morx/GSUB preference code. But if GSUB has non-zero scripts, we tend
* to prefer it over morx because we want to be consistent with other OpenType
* shapers.
*
* To work around broken Indic Mac system fonts, we ignore GSUB table if
* OS/2 VendorId is 'MUTF' and font has morx table as well.
*
* https://github.com/harfbuzz/harfbuzz/issues/1410
* https://github.com/harfbuzz/harfbuzz/issues/1348
* https://github.com/harfbuzz/harfbuzz/issues/1391
*/
if (unlikely (face->table.OS2->achVendID == HB_TAG ('M','U','T','F') &&
face->table.morx->has_data ()))
return true;
#endif
return false;
}

View File

@ -63,23 +63,6 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
const hb_feature_t *user_features,
unsigned int num_user_features);
#ifndef HB_NO_AAT_SHAPE
static inline bool
_hb_apply_morx (hb_face_t *face)
{
if (hb_options ().aat &&
hb_aat_layout_has_substitution (face))
return true;
/* Ignore empty GSUB tables. */
return (!hb_ot_layout_has_substitution (face) ||
!hb_ot_layout_table_get_script_tags (face,
HB_OT_TAG_GSUB,
0, nullptr, nullptr)) &&
hb_aat_layout_has_substitution (face);
}
#endif
hb_ot_shape_planner_t::hb_ot_shape_planner_t (hb_face_t *face,
const hb_segment_properties_t *props) :
face (face),
@ -87,7 +70,7 @@ hb_ot_shape_planner_t::hb_ot_shape_planner_t (hb_face_t *fac
map (face, props),
aat_map (face, props)
#ifndef HB_NO_AAT_SHAPE
, apply_morx (_hb_apply_morx (face))
, apply_morx (hb_aat_layout_has_substitution (face))
#endif
{
shaper = hb_ot_shape_complex_categorize (this);
@ -156,15 +139,11 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
if (0)
;
#ifndef HB_NO_AAT_SHAPE
else if (hb_options ().aat && hb_aat_layout_has_positioning (face))
else if (hb_aat_layout_has_positioning (face))
plan.apply_kerx = true;
#endif
else if (!apply_morx && !disable_gpos && hb_ot_layout_has_positioning (face))
plan.apply_gpos = true;
#ifndef HB_NO_AAT_SHAPE
else if (hb_aat_layout_has_positioning (face))
plan.apply_kerx = true;
#endif
if (!plan.apply_kerx && (!has_gpos_kern || !plan.apply_gpos))
{