[normalizer] Add c.override_decompose_and_compose

pull/4748/head
Behdad Esfahbod 9 months ago
parent 8a9bc52303
commit 0c2f5ecd51
  1. 5
      src/hb-ot-shape-normalize.cc
  2. 14
      src/hb-ot-shape-normalize.hh

@ -290,15 +290,14 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
mode = HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
}
const hb_ot_shape_normalize_context_t c = {
hb_ot_shape_normalize_context_t c = {
plan,
buffer,
font,
buffer->unicode,
buffer->not_found,
plan->shaper->decompose ? plan->shaper->decompose : hb_ot_shape_normalize_context_t::decompose_unicode,
plan->shaper->compose ? plan->shaper->compose : hb_ot_shape_normalize_context_t::compose_unicode
};
c.override_decompose_and_compose (plan->shaper->decompose, plan->shaper->compose);
bool always_short_circuit = mode == HB_OT_SHAPE_NORMALIZATION_MODE_NONE;
bool might_short_circuit = always_short_circuit ||

@ -71,6 +71,20 @@ struct hb_ot_shape_normalize_context_t
return (bool) c->unicode->compose (a, b, ab);
}
void
override_decompose_and_compose (bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t ab,
hb_codepoint_t *a,
hb_codepoint_t *b),
bool (*compose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t a,
hb_codepoint_t b,
hb_codepoint_t *ab))
{
this->decompose = decompose ? decompose : decompose_unicode;
this->compose = compose ? compose : compose_unicode;
}
const hb_ot_shape_plan_t *plan;
hb_buffer_t *buffer;
hb_font_t *font;

Loading…
Cancel
Save