mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 985220 pt 3 - when zeroing the width of mark glyphs, also update their offset to overstrike preceding glyph. r=behdad
This commit is contained in:
parent
dd35e0a8ba
commit
4a13080c9f
@ -330,8 +330,11 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
|
||||
if (unlikely (buffer->in_error))
|
||||
return;
|
||||
|
||||
/* Ok, let's see... */
|
||||
/* Make Nikhahit be recognized as a mark when zeroing widths. */
|
||||
unsigned int end = buffer->out_len;
|
||||
_hb_glyph_info_set_general_category (&buffer->out_info[end - 2], HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK);
|
||||
|
||||
/* Ok, let's see... */
|
||||
unsigned int start = end - 2;
|
||||
while (start > 0 && IS_TONE_MARK (buffer->out_info[start - 1].codepoint))
|
||||
start--;
|
||||
|
@ -452,26 +452,42 @@ hb_ot_substitute (hb_ot_shape_context_t *c)
|
||||
/* Position */
|
||||
|
||||
static inline void
|
||||
zero_mark_widths_by_unicode (hb_buffer_t *buffer)
|
||||
adjust_mark_offsets (hb_glyph_position_t *pos)
|
||||
{
|
||||
pos->x_offset -= pos->x_advance;
|
||||
pos->y_offset -= pos->y_advance;
|
||||
}
|
||||
|
||||
static inline void
|
||||
zero_mark_width (hb_glyph_position_t *pos)
|
||||
{
|
||||
pos->x_advance = 0;
|
||||
pos->y_advance = 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
zero_mark_widths_by_unicode (hb_buffer_t *buffer, bool adjust_offsets)
|
||||
{
|
||||
unsigned int count = buffer->len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
|
||||
{
|
||||
buffer->pos[i].x_advance = 0;
|
||||
buffer->pos[i].y_advance = 0;
|
||||
if (adjust_offsets)
|
||||
adjust_mark_offsets (&buffer->pos[i]);
|
||||
zero_mark_width (&buffer->pos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
zero_mark_widths_by_gdef (hb_buffer_t *buffer)
|
||||
zero_mark_widths_by_gdef (hb_buffer_t *buffer, bool adjust_offsets)
|
||||
{
|
||||
unsigned int count = buffer->len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
if (_hb_glyph_info_is_mark (&buffer->info[i]))
|
||||
{
|
||||
buffer->pos[i].x_advance = 0;
|
||||
buffer->pos[i].y_advance = 0;
|
||||
if (adjust_offsets)
|
||||
adjust_mark_offsets (&buffer->pos[i]);
|
||||
zero_mark_width (&buffer->pos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -501,16 +517,19 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
|
||||
{
|
||||
bool ret = false;
|
||||
unsigned int count = c->buffer->len;
|
||||
bool has_positioning = hb_ot_layout_has_positioning (c->face);
|
||||
bool adjust_offsets_when_zeroing = !(has_positioning || c->plan->shaper->fallback_position ||
|
||||
HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction));
|
||||
|
||||
switch (c->plan->shaper->zero_width_marks)
|
||||
{
|
||||
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
|
||||
zero_mark_widths_by_gdef (c->buffer);
|
||||
zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing);
|
||||
break;
|
||||
|
||||
/* Not currently used for any shaper:
|
||||
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
|
||||
zero_mark_widths_by_unicode (c->buffer);
|
||||
zero_mark_widths_by_unicode (c->buffer, adjust_offsets_when_zeroing);
|
||||
break;
|
||||
*/
|
||||
|
||||
@ -521,7 +540,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
|
||||
break;
|
||||
}
|
||||
|
||||
if (hb_ot_layout_has_positioning (c->face))
|
||||
if (has_positioning)
|
||||
{
|
||||
hb_glyph_info_t *info = c->buffer->info;
|
||||
hb_glyph_position_t *pos = c->buffer->pos;
|
||||
@ -550,11 +569,11 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
|
||||
switch (c->plan->shaper->zero_width_marks)
|
||||
{
|
||||
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
|
||||
zero_mark_widths_by_unicode (c->buffer);
|
||||
zero_mark_widths_by_unicode (c->buffer, adjust_offsets_when_zeroing);
|
||||
break;
|
||||
|
||||
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
|
||||
zero_mark_widths_by_gdef (c->buffer);
|
||||
zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user