[kerx] Hook up to shaper

pull/1234/head
Behdad Esfahbod 6 years ago
parent 8d00c39bfc
commit 2091b509e3
  1. 31
      src/hb-aat-layout.cc
  2. 3
      src/hb-aat-layout.hh
  3. 6
      src/hb-ot-shape.cc
  4. 1
      src/hb-ot-shape.hh

@ -54,6 +54,21 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
*blob = hb_ot_face_data (face)->morx.get_blob ();
return morx;
}
static inline const AAT::kerx&
_get_kerx (hb_face_t *face, hb_blob_t **blob = nullptr)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
{
if (blob)
*blob = hb_blob_get_empty ();
return Null(AAT::kerx);
}
const AAT::kerx& kerx = *(hb_ot_face_data (face)->kerx.get ());
if (blob)
*blob = hb_ot_face_data (face)->kerx.get_blob ();
return kerx;
}
hb_bool_t
hb_aat_layout_has_substitution (hb_face_t *face)
@ -73,19 +88,21 @@ hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
morx.apply (&c);
}
hb_bool_t
hb_aat_layout_has_positioning (hb_face_t *face)
{
return _get_kerx (face).has_data ();
}
void
hb_aat_layout_position (hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
#if 0
hb_blob_t *blob;
const AAT::ankr& ankr = _get_ankr (font->face, &blob);
const AAT::kerx& kerx = _get_kerx (font->face, &blob);
const AAT::trak& trak = _get_trak (font->face, &blob);
AAT::hb_aat_apply_context_t c (font, buffer, blob);
kerx.apply (&c, &ankr);
trak.apply (&c);
#endif
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
kerx.apply (&c);
}

@ -39,6 +39,9 @@ hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
HB_INTERNAL hb_bool_t
hb_aat_layout_has_positioning (hb_face_t *face);
HB_INTERNAL void
hb_aat_layout_position (hb_ot_shape_plan_t *plan,
hb_font_t *font,

@ -69,14 +69,16 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
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_kerx = !plan.apply_gpos &&
hb_aat_layout_has_positioning (face);
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.apply_kern = !has_gpos_kern && !plan.apply_kerx && hb_ot_layout_has_kerning (face);
plan.fallback_kerning = !has_gpos_kern && !plan.apply_kerx && !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;

@ -51,6 +51,7 @@ struct hb_ot_shape_plan_t
bool fallback_mark_positioning : 1;
bool apply_morx : 1;
bool apply_kerx : 1;
bool apply_kern : 1;
bool apply_gpos : 1;

Loading…
Cancel
Save