emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 52f7440: Fix glyph string generation for multi-font


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] master 52f7440: Fix glyph string generation for multi-font compositions (Bug#26742)
Date: Sun, 7 May 2017 19:25:21 -0400 (EDT)

branch: master
commit 52f7440b8ea8e18f7e83f8d107bd5e4df1bda7b1
Author: YAMAMOTO Mitsuharu <address@hidden>
Commit: YAMAMOTO Mitsuharu <address@hidden>

    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.
---
 src/xdisp.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 41458c3..c730cda 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
 }
 
 
+/* 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)
          {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]