1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Fix glyph string generation for multi-font compositions (Bug#26742)

* src/xdisp.c (glyph_string_containing_background_width): New function.
(draw_glyphs): Use it to get correct background width.
(compute_overhangs_and_x): Don't change x in the middle of composite
characters.
This commit is contained in:
YAMAMOTO Mitsuharu 2017-05-08 08:20:53 +09:00
parent 3c4c8ca06e
commit 52f7440b8e

View File

@ -25421,6 +25421,20 @@ set_glyph_string_background_width (struct glyph_string *s, int start, int last_x
}
/* Return glyph string that shares background with glyph string S and
whose `background_width' member has been set. */
static struct glyph_string *
glyph_string_containing_background_width (struct glyph_string *s)
{
if (s->cmp)
while (s->cmp_from)
s = s->prev;
return s;
}
/* Compute overhangs and x-positions for glyph string S and its
predecessors, or successors. X is the starting x-position for S.
BACKWARD_P means process predecessors. */
@ -25434,7 +25448,8 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
{
if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
x -= s->width;
if (!s->cmp || s->cmp_to == s->cmp->glyph_len)
x -= s->width;
s->x = x;
s = s->prev;
}
@ -25446,7 +25461,8 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
s->x = x;
x += s->width;
if (!s->cmp || s->cmp_to == s->cmp->glyph_len)
x += s->width;
s = s->next;
}
}
@ -25778,7 +25794,10 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
USE_SAFE_ALLOCA;
BUILD_GLYPH_STRINGS (i, end, head, tail, hl, x, last_x);
if (tail)
x_reached = tail->x + tail->background_width;
{
s = glyph_string_containing_background_width (tail);
x_reached = s->x + s->background_width;
}
else
x_reached = x;
@ -25933,6 +25952,9 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
compute_overhangs_and_x (h, tail->x + tail->width, false);
append_glyph_string_lists (&head, &tail, h, t);
}
tail = glyph_string_containing_background_width (tail);
if (clip_tail)
clip_tail = glyph_string_containing_background_width (clip_tail);
if (clip_head || clip_tail)
for (s = head; s; s = s->next)
{