|
|
|
@ -213,8 +213,9 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void |
|
|
|
|
handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end) |
|
|
|
|
handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit) |
|
|
|
|
{ |
|
|
|
|
/* TODO Currently if there's a variation-selector we give-up, it's just too hard. */ |
|
|
|
|
hb_buffer_t * const buffer = c->buffer; |
|
|
|
|
hb_font_t * const font = c->font; |
|
|
|
|
for (; buffer->idx < end - 1;) { |
|
|
|
@ -250,27 +251,26 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, uns |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void |
|
|
|
|
decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end) |
|
|
|
|
decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit) |
|
|
|
|
{ |
|
|
|
|
hb_buffer_t * const buffer = c->buffer; |
|
|
|
|
/* TODO Currently if there's a variation-selector we give-up, it's just too hard. */ |
|
|
|
|
for (unsigned int i = buffer->idx; i < end; i++) |
|
|
|
|
if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) { |
|
|
|
|
handle_variation_selector_cluster (c, end); |
|
|
|
|
handle_variation_selector_cluster (c, end, short_circuit); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
while (buffer->idx < end) |
|
|
|
|
decompose_current_character (c, false); |
|
|
|
|
decompose_current_character (c, short_circuit); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void |
|
|
|
|
decompose_cluster (const hb_ot_shape_normalize_context_t *c, bool short_circuit, unsigned int end) |
|
|
|
|
decompose_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool might_short_circuit, bool always_short_circuit) |
|
|
|
|
{ |
|
|
|
|
if (likely (c->buffer->idx + 1 == end)) |
|
|
|
|
decompose_current_character (c, short_circuit); |
|
|
|
|
decompose_current_character (c, might_short_circuit); |
|
|
|
|
else |
|
|
|
|
decompose_multi_char_cluster (c, end); |
|
|
|
|
decompose_multi_char_cluster (c, end, always_short_circuit); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -299,8 +299,10 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, |
|
|
|
|
plan->shaper->compose ? plan->shaper->compose : compose_unicode |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
bool short_circuit = mode != HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED && |
|
|
|
|
mode != HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT; |
|
|
|
|
bool always_short_circuit = mode == HB_OT_SHAPE_NORMALIZATION_MODE_NONE; |
|
|
|
|
bool might_short_circuit = always_short_circuit || |
|
|
|
|
(mode != HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED && |
|
|
|
|
mode != HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT); |
|
|
|
|
unsigned int count; |
|
|
|
|
|
|
|
|
|
/* We do a fairly straightforward yet custom normalization process in three
|
|
|
|
@ -321,7 +323,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, |
|
|
|
|
if (buffer->cur().cluster != buffer->info[end].cluster) |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
decompose_cluster (&c, short_circuit, end); |
|
|
|
|
decompose_cluster (&c, end, might_short_circuit, always_short_circuit); |
|
|
|
|
} |
|
|
|
|
buffer->swap_buffers (); |
|
|
|
|
|
|
|
|
|