[config] Add HB_NO_OT_KERN, enabled by HB_MINI / HB_NO_LEGACY

Part of https://github.com/harfbuzz/harfbuzz/issues/1652
This commit is contained in:
Behdad Esfahbod 2019-06-19 16:24:51 -07:00
parent 2e3e929d2b
commit 588697afd0
5 changed files with 26 additions and 5 deletions

View File

@ -101,6 +101,7 @@
#ifdef HB_NO_LEGACY
#define HB_NO_FALLBACK_SHAPE
#define HB_NO_OT_KERN
#define HB_NO_OT_LAYOUT_BLACKLIST
#define HB_NO_OT_SHAPE_FALLBACK
#endif

View File

@ -50,7 +50,6 @@ HB_OT_TABLE (OT, head)
HB_OT_ACCELERATOR (OT, cmap)
HB_OT_ACCELERATOR (OT, hmtx)
HB_OT_ACCELERATOR (OT, post)
HB_OT_TABLE (OT, kern)
HB_OT_ACCELERATOR (OT, name)
HB_OT_TABLE (OT, OS2)
HB_OT_TABLE (OT, STAT)
@ -73,6 +72,11 @@ HB_OT_TABLE (OT, fvar)
HB_OT_TABLE (OT, avar)
HB_OT_TABLE (OT, MVAR)
/* Legacy kern. */
#ifndef HB_NO_OT_KERN
HB_OT_TABLE (OT, kern)
#endif
/* OpenType shaping. */
HB_OT_ACCELERATOR (OT, GDEF)
HB_OT_ACCELERATOR (OT, GSUB)

View File

@ -62,6 +62,7 @@
* kern
*/
#ifndef HB_NO_OT_KERN
/**
* hb_ot_layout_has_kerning:
* @face: The #hb_face_t to work on
@ -78,7 +79,6 @@ hb_ot_layout_has_kerning (hb_face_t *face)
return face->table.kern->has_data ();
}
/**
* hb_ot_layout_has_machine_kerning:
* @face: The #hb_face_t to work on
@ -95,7 +95,6 @@ hb_ot_layout_has_machine_kerning (hb_face_t *face)
return face->table.kern->has_state_machine ();
}
/**
* hb_ot_layout_has_cross_kerning:
* @face: The #hb_face_t to work on
@ -128,6 +127,7 @@ hb_ot_layout_kern (const hb_ot_shape_plan_t *plan,
kern.apply (&c);
}
#endif
/*

View File

@ -157,18 +157,28 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
plan.apply_kerx = true;
else
#endif
#ifndef HB_NO_OT_KERN
if (hb_ot_layout_has_kerning (face))
plan.apply_kern = true;
#endif
}
plan.zero_marks = script_zero_marks &&
!plan.apply_kerx &&
(!plan.apply_kern || !hb_ot_layout_has_machine_kerning (face));
(!plan.apply_kern
#ifndef HB_NO_OT_KERN
|| !hb_ot_layout_has_machine_kerning (face)
#endif
);
plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
plan.adjust_mark_positioning_when_zeroing = !plan.apply_gpos &&
!plan.apply_kerx &&
(!plan.apply_kern || !hb_ot_layout_has_cross_kerning (face));
(!plan.apply_kern
#ifndef HB_NO_OT_KERN
|| !hb_ot_layout_has_cross_kerning (face)
#endif
);
plan.fallback_mark_positioning = plan.adjust_mark_positioning_when_zeroing &&
script_fallback_mark_positioning;
@ -237,8 +247,10 @@ hb_ot_shape_plan_t::position (hb_font_t *font,
else if (this->apply_kerx)
hb_aat_layout_position (this, font, buffer);
#endif
#ifndef HB_NO_OT_KERN
else if (this->apply_kern)
hb_ot_layout_kern (this, font, buffer);
#endif
else
_hb_ot_shape_fallback_kern (this, font, buffer);

View File

@ -80,7 +80,11 @@ struct hb_ot_shape_plan_t
bool adjust_mark_positioning_when_zeroing : 1;
bool apply_gpos : 1;
#ifndef HB_NO_OT_KERN
bool apply_kern : 1;
#else
static constexpr bool apply_kern = false;
#endif
#ifndef HB_NO_SHAPE_AAT
bool apply_kerx : 1;
bool apply_morx : 1;