]> git.eshelyaron.com Git - emacs.git/commitdiff
(x_draw_glyph_string): Be sure to draw underline within the current
authorKenichi Handa <handa@m17n.org>
Fri, 23 May 2008 05:33:24 +0000 (05:33 +0000)
committerKenichi Handa <handa@m17n.org>
Fri, 23 May 2008 05:33:24 +0000 (05:33 +0000)
line area.

src/ChangeLog
src/xterm.c

index 3dd1a95177eb169f9a4e55daafff3b5c768779dd..62ea887f9f0c08eff7e404fa94d269ad554d51ff 100644 (file)
@@ -4,7 +4,8 @@
        s->underline_thickness and s->underline_position.
 
        * xterm.c (x_draw_glyph_string): Be sure to update
-       s->underline_thickness and s->underline_position.
+       s->underline_thickness and s->underline_position.  Be sore to draw
+       underline within the current line area.
 
        * fontset.c: Delete unused variables and add casting for char *
        throughout the file.
index b4c49d4085f514147a754560babd91118a612cd3..b2683298ca05a31484d605a23389bfb6c459e18a 100644 (file)
@@ -2743,6 +2743,12 @@ x_draw_glyph_string (s)
                    position = (s->font->descent + 1) / 2;
                }
            }
+         /* Check the sanity of thickness and position.  We should
+            avoid drawing underline out of the current line area.  */
+         if (s->y + s->height <= s->ybase + position)
+           position = s->y + s->height - 1;
+         if (s->y + s->height < s->ybase + position + thickness)
+           thickness = (s->y + s->height) - (s->ybase + position);
          s->underline_thickness = thickness;
          s->underline_position = position;
          y = s->ybase + position;