diff --git a/src/hb-config.hh b/src/hb-config.hh index c1a15f86e..e02694bef 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -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 diff --git a/src/hb-ot-face-table-list.hh b/src/hb-ot-face-table-list.hh index 74ee1985e..1dcfad4c9 100644 --- a/src/hb-ot-face-table-list.hh +++ b/src/hb-ot-face-table-list.hh @@ -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) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 0e75049c8..0761b8e53 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -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 /* diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 635fa9403..f5f1ae6cc 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -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); diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index b7c0f1065..09164427e 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -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;