changeset 95245:4e2f379d6e44

(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 05:33:08 +0000
parents 91375185a2f2
children 7e6c63f88fb3
files src/xterm.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Fri May 23 04:46:47 2008 +0000
+++ b/src/xterm.c	Fri May 23 05:33:08 2008 +0000
@@ -2743,6 +2743,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;