diff options
| author | YAMAMOTO Mitsuharu | 2017-05-08 08:20:53 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2017-05-08 08:20:53 +0900 |
| commit | 52f7440b8ea8e18f7e83f8d107bd5e4df1bda7b1 (patch) | |
| tree | 7c5dc38ea533bbf7ee0a5033278211b7fdcf908c | |
| parent | 3c4c8ca06e3306ccbcd07e354eb51abe53b52d22 (diff) | |
| download | emacs-52f7440b8ea8e18f7e83f8d107bd5e4df1bda7b1.tar.gz emacs-52f7440b8ea8e18f7e83f8d107bd5e4df1bda7b1.zip | |
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.
| -rw-r--r-- | src/xdisp.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 41458c38176..c730cdae054 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -25421,6 +25421,20 @@ set_glyph_string_background_width (struct glyph_string *s, int start, int last_x | |||
| 25421 | } | 25421 | } |
| 25422 | 25422 | ||
| 25423 | 25423 | ||
| 25424 | /* Return glyph string that shares background with glyph string S and | ||
| 25425 | whose `background_width' member has been set. */ | ||
| 25426 | |||
| 25427 | static struct glyph_string * | ||
| 25428 | glyph_string_containing_background_width (struct glyph_string *s) | ||
| 25429 | { | ||
| 25430 | if (s->cmp) | ||
| 25431 | while (s->cmp_from) | ||
| 25432 | s = s->prev; | ||
| 25433 | |||
| 25434 | return s; | ||
| 25435 | } | ||
| 25436 | |||
| 25437 | |||
| 25424 | /* Compute overhangs and x-positions for glyph string S and its | 25438 | /* Compute overhangs and x-positions for glyph string S and its |
| 25425 | predecessors, or successors. X is the starting x-position for S. | 25439 | predecessors, or successors. X is the starting x-position for S. |
| 25426 | BACKWARD_P means process predecessors. */ | 25440 | BACKWARD_P means process predecessors. */ |
| @@ -25434,7 +25448,8 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p) | |||
| 25434 | { | 25448 | { |
| 25435 | if (FRAME_RIF (s->f)->compute_glyph_string_overhangs) | 25449 | if (FRAME_RIF (s->f)->compute_glyph_string_overhangs) |
| 25436 | FRAME_RIF (s->f)->compute_glyph_string_overhangs (s); | 25450 | FRAME_RIF (s->f)->compute_glyph_string_overhangs (s); |
| 25437 | x -= s->width; | 25451 | if (!s->cmp || s->cmp_to == s->cmp->glyph_len) |
| 25452 | x -= s->width; | ||
| 25438 | s->x = x; | 25453 | s->x = x; |
| 25439 | s = s->prev; | 25454 | s = s->prev; |
| 25440 | } | 25455 | } |
| @@ -25446,7 +25461,8 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p) | |||
| 25446 | if (FRAME_RIF (s->f)->compute_glyph_string_overhangs) | 25461 | if (FRAME_RIF (s->f)->compute_glyph_string_overhangs) |
| 25447 | FRAME_RIF (s->f)->compute_glyph_string_overhangs (s); | 25462 | FRAME_RIF (s->f)->compute_glyph_string_overhangs (s); |
| 25448 | s->x = x; | 25463 | s->x = x; |
| 25449 | x += s->width; | 25464 | if (!s->cmp || s->cmp_to == s->cmp->glyph_len) |
| 25465 | x += s->width; | ||
| 25450 | s = s->next; | 25466 | s = s->next; |
| 25451 | } | 25467 | } |
| 25452 | } | 25468 | } |
| @@ -25778,7 +25794,10 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, | |||
| 25778 | USE_SAFE_ALLOCA; | 25794 | USE_SAFE_ALLOCA; |
| 25779 | BUILD_GLYPH_STRINGS (i, end, head, tail, hl, x, last_x); | 25795 | BUILD_GLYPH_STRINGS (i, end, head, tail, hl, x, last_x); |
| 25780 | if (tail) | 25796 | if (tail) |
| 25781 | x_reached = tail->x + tail->background_width; | 25797 | { |
| 25798 | s = glyph_string_containing_background_width (tail); | ||
| 25799 | x_reached = s->x + s->background_width; | ||
| 25800 | } | ||
| 25782 | else | 25801 | else |
| 25783 | x_reached = x; | 25802 | x_reached = x; |
| 25784 | 25803 | ||
| @@ -25933,6 +25952,9 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, | |||
| 25933 | compute_overhangs_and_x (h, tail->x + tail->width, false); | 25952 | compute_overhangs_and_x (h, tail->x + tail->width, false); |
| 25934 | append_glyph_string_lists (&head, &tail, h, t); | 25953 | append_glyph_string_lists (&head, &tail, h, t); |
| 25935 | } | 25954 | } |
| 25955 | tail = glyph_string_containing_background_width (tail); | ||
| 25956 | if (clip_tail) | ||
| 25957 | clip_tail = glyph_string_containing_background_width (clip_tail); | ||
| 25936 | if (clip_head || clip_tail) | 25958 | if (clip_head || clip_tail) |
| 25937 | for (s = head; s; s = s->next) | 25959 | for (s = head; s; s = s->next) |
| 25938 | { | 25960 | { |