diff src/w32term.c @ 95247:32b09637961a

(x_draw_glyph_string): Be sure to draw underline within the current line area.
author Kenichi Handa <handa@m17n.org>
date Fri, 23 May 2008 06:11:53 +0000
parents b4799755ba3d
children e76b055e122c
line wrap: on
line diff
--- a/src/w32term.c	Fri May 23 05:33:24 2008 +0000
+++ b/src/w32term.c	Fri May 23 06:11:53 2008 +0000
@@ -2909,6 +2909,12 @@
                   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;