summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc60
1 files changed, 52 insertions, 8 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc
index c63c3adee0c..7690c22294a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc
@@ -98,21 +98,30 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
plan.props = props;
plan.shaper = shaper;
map.compile (plan.map, key);
+#ifndef HB_NO_SHAPE_AAT
if (apply_morx)
aat_map.compile (plan.aat_map);
+#endif
+#ifndef HB_NO_OT_SHAPE_FRACTIONS
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.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask);
+#endif
+
plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m'));
hb_tag_t kern_tag = HB_DIRECTION_IS_HORIZONTAL (props.direction) ?
HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n');
+#ifndef HB_NO_OT_KERN
plan.kern_mask = plan.map.get_mask (kern_tag);
- plan.trak_mask = plan.map.get_mask (HB_TAG ('t','r','a','k'));
-
plan.requested_kerning = !!plan.kern_mask;
+#endif
+#ifndef HB_NO_SHAPE_AAT
+ plan.trak_mask = plan.map.get_mask (HB_TAG ('t','r','a','k'));
plan.requested_tracking = !!plan.trak_mask;
+#endif
+
bool has_gpos_kern = plan.map.get_feature_index (1, kern_tag) != HB_OT_LAYOUT_NO_FEATURE_INDEX;
bool disable_gpos = plan.shaper->gpos_tag &&
plan.shaper->gpos_tag != plan.map.chosen_script[1];
@@ -152,24 +161,33 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
if (!plan.apply_kerx && !has_gpos_kern)
{
/* Apparently Apple applies kerx if GPOS kern was not applied. */
- if (0)
- ;
#ifndef HB_NO_SHAPE_AAT
- else if (hb_aat_layout_has_positioning (face))
+ if (hb_aat_layout_has_positioning (face))
plan.apply_kerx = true;
+ else
#endif
- else if (hb_ot_layout_has_kerning (face))
+#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;
@@ -185,7 +203,9 @@ hb_ot_shape_plan_t::init0 (hb_face_t *face,
const hb_shape_plan_key_t *key)
{
map.init ();
+#ifndef HB_NO_SHAPE_AAT
aat_map.init ();
+#endif
hb_ot_shape_planner_t planner (face,
&key->props);
@@ -213,16 +233,20 @@ hb_ot_shape_plan_t::fini ()
shaper->data_destroy (const_cast<void *> (data));
map.fini ();
+#ifndef HB_NO_SHAPE_AAT
aat_map.fini ();
+#endif
}
void
hb_ot_shape_plan_t::substitute (hb_font_t *font,
hb_buffer_t *buffer) const
{
+#ifndef HB_NO_SHAPE_AAT
if (unlikely (apply_morx))
hb_aat_layout_substitute (this, font, buffer);
else
+#endif
map.substitute (this, font, buffer);
}
@@ -232,15 +256,21 @@ hb_ot_shape_plan_t::position (hb_font_t *font,
{
if (this->apply_gpos)
map.position (this, font, buffer);
+#ifndef HB_NO_SHAPE_AAT
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);
+#ifndef HB_NO_SHAPE_AAT
if (this->apply_trak)
hb_aat_layout_track (this, font, buffer);
+#endif
}
@@ -292,18 +322,22 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
break;
}
+#ifndef HB_NO_OT_SHAPE_FRACTIONS
/* Automatic fractions. */
map->add_feature (HB_TAG ('f','r','a','c'));
map->add_feature (HB_TAG ('n','u','m','r'));
map->add_feature (HB_TAG ('d','n','o','m'));
+#endif
/* Random! */
map->enable_feature (HB_TAG ('r','a','n','d'), F_RANDOM, HB_OT_MAP_MAX_VALUE);
+#ifndef HB_NO_SHAPE_AAT
/* Tracking. We enable dummy feature here just to allow disabling
* AAT 'trak' table using features.
* https://github.com/harfbuzz/harfbuzz/issues/1303 */
map->enable_feature (HB_TAG ('t','r','a','k'), F_HAS_FALLBACK);
+#endif
map->enable_feature (HB_TAG ('H','A','R','F'));
@@ -336,6 +370,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
feature->value);
}
+#ifndef HB_NO_SHAPE_AAT
if (planner->apply_morx)
{
hb_aat_map_builder_t *aat_map = &planner->aat_map;
@@ -345,6 +380,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
aat_map->add_feature (feature->tag, feature->value);
}
}
+#endif
if (planner->shaper->override_features)
planner->shaper->override_features (planner);
@@ -569,6 +605,10 @@ hb_ot_mirror_chars (const hb_ot_shape_context_t *c)
static inline void
hb_ot_shape_setup_masks_fraction (const hb_ot_shape_context_t *c)
{
+#ifdef HB_NO_OT_SHAPE_FRACTIONS
+ return;
+#endif
+
if (!(c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
!c->plan->has_frac)
return;
@@ -779,8 +819,10 @@ static inline void
hb_ot_substitute_post (const hb_ot_shape_context_t *c)
{
hb_ot_hide_default_ignorables (c->buffer, c->font);
+#ifndef HB_NO_SHAPE_AAT
if (c->plan->apply_morx)
hb_aat_layout_remove_deleted_glyphs (c->buffer);
+#endif
if (c->plan->shaper->postprocess_glyphs)
c->plan->shaper->postprocess_glyphs (c->plan, c->buffer, c->font);
@@ -914,8 +956,10 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c)
/* Finish off. Has to follow a certain order. */
hb_ot_layout_position_finish_advances (c->font, c->buffer);
hb_ot_zero_width_default_ignorables (c->buffer);
+#ifndef HB_NO_SHAPE_AAT
if (c->plan->apply_morx)
hb_aat_layout_zero_width_deleted_glyphs (c->buffer);
+#endif
hb_ot_layout_position_finish_offsets (c->font, c->buffer);
/* The nil glyph_h_origin() func returns 0, so no need to apply it. */