Apply morx if there's no GSUB!

This commit is contained in:
Behdad Esfahbod 2018-10-04 11:34:21 +02:00
parent 3417037eb1
commit 14ff3cbe0f
4 changed files with 29 additions and 45 deletions

View File

@ -63,9 +63,14 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
plan.kerning_requested = !!plan.kern_mask;
plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
plan.apply_morx = !hb_ot_layout_has_substitution (face) &&
hb_aat_layout_has_substitution (face);
bool disable_gpos = plan.shaper->gpos_tag &&
plan.shaper->gpos_tag != plan.map.chosen_script[1];
plan.fallback_positioning = disable_gpos || !hb_ot_layout_has_positioning (face);
plan.apply_gpos = !disable_gpos && hb_ot_layout_has_positioning (face);
plan.fallback_positioning = !plan.apply_gpos;
plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face);
}
@ -217,7 +222,13 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
hb_ot_shape_planner_t planner (shape_plan);
planner.shaper = hb_ot_shape_complex_categorize (&planner);
/* Ugly that we have to do this here...
* If we are going to apply morx, choose default shaper. */
if (!hb_ot_layout_has_substitution (planner.face) &&
hb_aat_layout_has_substitution (planner.face))
planner.shaper = &_hb_ot_complex_shaper_default;
else
planner.shaper = hb_ot_shape_complex_categorize (&planner);
hb_ot_shape_collect_features (&planner, &shape_plan->props,
user_features, num_user_features);
@ -661,10 +672,10 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
if (c->plan->fallback_glyph_classes)
hb_synthesize_glyph_classes (c);
c->plan->substitute (c->font, buffer);
if (0) /* XXX Call morx instead. */
if (unlikely (c->plan->apply_morx))
hb_aat_layout_substitute (c->font, c->buffer);
else
c->plan->substitute (c->font, buffer);
}
static inline void
@ -784,7 +795,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
break;
}
if (likely (!c->plan->fallback_positioning))
if (c->plan->apply_gpos)
c->plan->position (c->font, c->buffer);
switch (c->plan->shaper->zero_width_marks)

View File

@ -49,6 +49,11 @@ struct hb_ot_shape_plan_t
bool fallback_positioning : 1;
bool fallback_glyph_classes : 1;
bool apply_morx : 1;
bool apply_gpos : 1;
inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
{
unsigned int table_index;

View File

@ -1,38 +1,6 @@
# Non-Unicode cmap
tests/CMAP-3.tests
# Not hooked up
tests/MORX-1.tests
tests/MORX-2.tests
tests/MORX-3.tests
tests/MORX-4.tests
tests/MORX-5.tests
tests/MORX-6.tests
tests/MORX-7.tests
tests/MORX-8.tests
tests/MORX-9.tests
tests/MORX-10.tests
tests/MORX-11.tests
tests/MORX-12.tests
tests/MORX-13.tests
tests/MORX-14.tests
tests/MORX-16.tests
tests/MORX-17.tests
tests/MORX-18.tests
tests/MORX-19.tests
tests/MORX-20.tests
tests/MORX-21.tests
tests/MORX-22.tests
tests/MORX-23.tests
tests/MORX-25.tests
tests/MORX-26.tests
tests/MORX-27.tests
tests/MORX-28.tests
tests/MORX-29.tests
tests/MORX-30.tests
tests/MORX-31.tests
tests/MORX-32.tests
# Rounding differences
tests/SHARAN-1.tests
tests/SHBALI-1.tests

View File

@ -28,12 +28,6 @@ TESTS = \
tests/HVAR-2.tests \
tests/KERN-1.tests \
tests/KERN-2.tests \
tests/SHBALI-3.tests \
tests/SHKNDA-1.tests \
$(NULL)
DISBALED_TESTS = \
tests/CMAP-3.tests \
tests/MORX-10.tests \
tests/MORX-11.tests \
tests/MORX-12.tests \
@ -56,7 +50,6 @@ DISBALED_TESTS = \
tests/MORX-2.tests \
tests/MORX-30.tests \
tests/MORX-31.tests \
tests/MORX-32.tests \
tests/MORX-3.tests \
tests/MORX-4.tests \
tests/MORX-5.tests \
@ -64,9 +57,16 @@ DISBALED_TESTS = \
tests/MORX-7.tests \
tests/MORX-8.tests \
tests/MORX-9.tests \
tests/SHBALI-3.tests \
tests/SHKNDA-1.tests \
$(NULL)
DISBALED_TESTS = \
tests/CMAP-3.tests \
tests/SHARAN-1.tests \
tests/SHBALI-1.tests \
tests/SHBALI-2.tests \
tests/SHKNDA-2.tests \
tests/SHKNDA-3.tests \
tests/MORX-32.tests \
$(NULL)