Revert "[ot-shape-normalize] Move buffer out of hb_ot_shape_normalize_context_t"
This reverts commit8cdbea5580
. For some reason this is causing several tests to crash locally for me (on macOS), see:8cdbea5580 (commitcomment-55898088)
This commit is contained in:
parent
f4559d2435
commit
195c05df99
|
@ -122,12 +122,10 @@ skip_char (hb_buffer_t *buffer)
|
||||||
|
|
||||||
/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
|
/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
|
||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
decompose (const hb_ot_shape_normalize_context_t *c,
|
decompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint_t ab)
|
||||||
hb_buffer_t *buffer,
|
|
||||||
bool shortest,
|
|
||||||
hb_codepoint_t ab)
|
|
||||||
{
|
{
|
||||||
hb_codepoint_t a = 0, b = 0, a_glyph = 0, b_glyph = 0;
|
hb_codepoint_t a = 0, b = 0, a_glyph = 0, b_glyph = 0;
|
||||||
|
hb_buffer_t * const buffer = c->buffer;
|
||||||
hb_font_t * const font = c->font;
|
hb_font_t * const font = c->font;
|
||||||
|
|
||||||
if (!c->decompose (c, ab, &a, &b) ||
|
if (!c->decompose (c, ab, &a, &b) ||
|
||||||
|
@ -146,7 +144,7 @@ decompose (const hb_ot_shape_normalize_context_t *c,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
if ((ret = decompose (c, buffer, shortest, a))) {
|
if ((ret = decompose (c, shortest, a))) {
|
||||||
if (b) {
|
if (b) {
|
||||||
output_char (buffer, b, b_glyph);
|
output_char (buffer, b, b_glyph);
|
||||||
return ret + 1;
|
return ret + 1;
|
||||||
|
@ -167,10 +165,9 @@ decompose (const hb_ot_shape_normalize_context_t *c,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
decompose_current_character (const hb_ot_shape_normalize_context_t *c,
|
decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest)
|
||||||
hb_buffer_t *buffer,
|
|
||||||
bool shortest)
|
|
||||||
{
|
{
|
||||||
|
hb_buffer_t * const buffer = c->buffer;
|
||||||
hb_codepoint_t u = buffer->cur().codepoint;
|
hb_codepoint_t u = buffer->cur().codepoint;
|
||||||
hb_codepoint_t glyph = 0;
|
hb_codepoint_t glyph = 0;
|
||||||
|
|
||||||
|
@ -180,7 +177,7 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decompose (c, buffer, shortest, u))
|
if (decompose (c, shortest, u))
|
||||||
{
|
{
|
||||||
skip_char (buffer);
|
skip_char (buffer);
|
||||||
return;
|
return;
|
||||||
|
@ -222,11 +219,11 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c,
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c,
|
handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c,
|
||||||
hb_buffer_t *buffer,
|
|
||||||
unsigned int end,
|
unsigned int end,
|
||||||
bool short_circuit HB_UNUSED)
|
bool short_circuit HB_UNUSED)
|
||||||
{
|
{
|
||||||
/* TODO Currently if there's a variation-selector we give-up, it's just too hard. */
|
/* 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;
|
hb_font_t * const font = c->font;
|
||||||
for (; buffer->idx < end - 1 && buffer->successful;) {
|
for (; buffer->idx < end - 1 && buffer->successful;) {
|
||||||
if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) {
|
if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) {
|
||||||
|
@ -266,19 +263,17 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c,
|
decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit)
|
||||||
hb_buffer_t *buffer,
|
|
||||||
unsigned int end,
|
|
||||||
bool short_circuit)
|
|
||||||
{
|
{
|
||||||
|
hb_buffer_t * const buffer = c->buffer;
|
||||||
for (unsigned int i = buffer->idx; i < end && buffer->successful; i++)
|
for (unsigned int i = buffer->idx; i < end && buffer->successful; i++)
|
||||||
if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) {
|
if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) {
|
||||||
handle_variation_selector_cluster (c, buffer, end, short_circuit);
|
handle_variation_selector_cluster (c, end, short_circuit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (buffer->idx < end && buffer->successful)
|
while (buffer->idx < end && buffer->successful)
|
||||||
decompose_current_character (c, buffer, short_circuit);
|
decompose_current_character (c, short_circuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -314,6 +309,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
|
||||||
|
|
||||||
const hb_ot_shape_normalize_context_t c = {
|
const hb_ot_shape_normalize_context_t c = {
|
||||||
plan,
|
plan,
|
||||||
|
buffer,
|
||||||
font,
|
font,
|
||||||
buffer->unicode,
|
buffer->unicode,
|
||||||
plan->shaper->decompose ? plan->shaper->decompose : decompose_unicode,
|
plan->shaper->decompose ? plan->shaper->decompose : decompose_unicode,
|
||||||
|
@ -361,7 +357,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
|
||||||
if (unlikely (!buffer->next_glyphs (done))) break;
|
if (unlikely (!buffer->next_glyphs (done))) break;
|
||||||
}
|
}
|
||||||
while (buffer->idx < end && buffer->successful)
|
while (buffer->idx < end && buffer->successful)
|
||||||
decompose_current_character (&c, buffer, might_short_circuit);
|
decompose_current_character (&c, might_short_circuit);
|
||||||
|
|
||||||
if (buffer->idx == count || !buffer->successful)
|
if (buffer->idx == count || !buffer->successful)
|
||||||
break;
|
break;
|
||||||
|
@ -374,7 +370,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* idx to end is one non-simple cluster. */
|
/* idx to end is one non-simple cluster. */
|
||||||
decompose_multi_char_cluster (&c, buffer, end, always_short_circuit);
|
decompose_multi_char_cluster (&c, end, always_short_circuit);
|
||||||
}
|
}
|
||||||
while (buffer->idx < count && buffer->successful);
|
while (buffer->idx < count && buffer->successful);
|
||||||
buffer->swap_buffers ();
|
buffer->swap_buffers ();
|
||||||
|
|
|
@ -53,6 +53,7 @@ HB_INTERNAL void _hb_ot_shape_normalize (const hb_ot_shape_plan_t *shaper,
|
||||||
struct hb_ot_shape_normalize_context_t
|
struct hb_ot_shape_normalize_context_t
|
||||||
{
|
{
|
||||||
const hb_ot_shape_plan_t *plan;
|
const hb_ot_shape_plan_t *plan;
|
||||||
|
hb_buffer_t *buffer;
|
||||||
hb_font_t *font;
|
hb_font_t *font;
|
||||||
hb_unicode_funcs_t *unicode;
|
hb_unicode_funcs_t *unicode;
|
||||||
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
|
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
|
||||||
|
|
Loading…
Reference in New Issue