Apply TT or fallback kerning when GPOS does not have kern feature Previously we only did if there was no GPOS whatsoever. This applies to Arial, Times New Roman, etc in Win7. Was not kerning before. It is now.
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 6753ceb..5555327 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc
@@ -52,27 +52,34 @@ map.compile (plan.map, coords, num_coords); plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m')); + plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c')); plan.numr_mask = plan.map.get_1_mask (HB_TAG ('n','u','m','r')); plan.dnom_mask = plan.map.get_1_mask (HB_TAG ('d','n','o','m')); - - plan.kern_mask = plan.map.get_mask (HB_DIRECTION_IS_HORIZONTAL (plan.props.direction) ? - HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n')); - plan.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask); - plan.kerning_requested = !!plan.kern_mask; - plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); + /* Decide who provides glyph classes. GDEF or Unicode. */ + plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face); + + /* Decide who does substitutions. GSUB, morx, or fallback. */ plan.apply_morx = !hb_ot_layout_has_substitution (face) && hb_aat_layout_has_substitution (face); + /* Decide who does positioning. GPOS, kerx, kern, or fallback. */ bool disable_gpos = plan.shaper->gpos_tag && plan.shaper->gpos_tag != plan.map.chosen_script[1]; plan.apply_gpos = !disable_gpos && hb_ot_layout_has_positioning (face); - plan.apply_kern = !plan.apply_gpos && hb_ot_layout_has_kerning (face); - plan.fallback_kerning = !plan.apply_gpos && !plan.apply_kern; + + hb_tag_t kern_tag = HB_DIRECTION_IS_HORIZONTAL (plan.props.direction) ? + HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n'); + plan.kern_mask = plan.map.get_mask (kern_tag); + plan.kerning_requested = !!plan.kern_mask; + bool has_gpos_kern = plan.map.get_feature_index (0, kern_tag) != HB_OT_LAYOUT_NO_FEATURE_INDEX; + plan.apply_kern = !has_gpos_kern && hb_ot_layout_has_kerning (face); + plan.fallback_kerning = !has_gpos_kern && !plan.apply_kern; + + plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); plan.fallback_mark_positioning = !plan.apply_gpos; - plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face); }