comparison src/xterm.c @ 95295:9a9e4682d009

(x_draw_glyph_string): Fix calculation of underline position.
author Kenichi Handa <handa@m17n.org>
date Sun, 25 May 2008 11:14:31 +0000
parents 4e2f379d6e44
children a9b4031fa99f
comparison
equal deleted inserted replaced
95294:50c2a5438c6c 95295:9a9e4682d009
2723 if (s->font && s->font->underline_thickness > 0) 2723 if (s->font && s->font->underline_thickness > 0)
2724 thickness = s->font->underline_thickness; 2724 thickness = s->font->underline_thickness;
2725 else 2725 else
2726 thickness = 1; 2726 thickness = 1;
2727 if (x_underline_at_descent_line) 2727 if (x_underline_at_descent_line)
2728 position = (s->height - thickness) - s->ybase; 2728 position = (s->height - thickness) - (s->ybase - s->y);
2729 else 2729 else
2730 { 2730 {
2731 /* Get the underline position. This is the recommended 2731 /* Get the underline position. This is the recommended
2732 vertical offset in pixels from the baseline to the top of 2732 vertical offset in pixels from the baseline to the top of
2733 the underline. This is a signed value according to the 2733 the underline. This is a signed value according to the
2744 } 2744 }
2745 } 2745 }
2746 /* Check the sanity of thickness and position. We should 2746 /* Check the sanity of thickness and position. We should
2747 avoid drawing underline out of the current line area. */ 2747 avoid drawing underline out of the current line area. */
2748 if (s->y + s->height <= s->ybase + position) 2748 if (s->y + s->height <= s->ybase + position)
2749 position = s->y + s->height - 1; 2749 position = (s->height - 1) - (s->ybase - s->y);
2750 if (s->y + s->height < s->ybase + position + thickness) 2750 if (s->y + s->height < s->ybase + position + thickness)
2751 thickness = (s->y + s->height) - (s->ybase + position); 2751 thickness = (s->y + s->height) - (s->ybase + position);
2752 s->underline_thickness = thickness; 2752 s->underline_thickness = thickness;
2753 s->underline_position = position; 2753 s->underline_position = position;
2754 y = s->ybase + position; 2754 y = s->ybase + position;