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.
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;