comparison src/w32term.c @ 95296:e76b055e122c

(x_draw_glyph_string): Fix calculation of underline position.
author Kenichi Handa <handa@m17n.org>
date Sun, 25 May 2008 11:17:07 +0000
parents 32b09637961a
children 03298b3ef01c
comparison
equal deleted inserted replaced
95295:9a9e4682d009 95296:e76b055e122c
2889 if (s->font && s->font->underline_thickness > 0) 2889 if (s->font && s->font->underline_thickness > 0)
2890 thickness = s->font->underline_thickness; 2890 thickness = s->font->underline_thickness;
2891 else 2891 else
2892 thickness = 1; 2892 thickness = 1;
2893 if (x_underline_at_descent_line) 2893 if (x_underline_at_descent_line)
2894 position = (s->height - thickness) - s->ybase; 2894 position = (s->height - thickness) - (s->ybase - s->y);
2895 else 2895 else
2896 { 2896 {
2897 /* Get the underline position. This is the recommended 2897 /* Get the underline position. This is the recommended
2898 vertical offset in pixels from the baseline to the top of 2898 vertical offset in pixels from the baseline to the top of
2899 the underline. This is a signed value according to the 2899 the underline. This is a signed value according to the
2910 } 2910 }
2911 } 2911 }
2912 /* Check the sanity of thickness and position. We should 2912 /* Check the sanity of thickness and position. We should
2913 avoid drawing underline out of the current line area. */ 2913 avoid drawing underline out of the current line area. */
2914 if (s->y + s->height <= s->ybase + position) 2914 if (s->y + s->height <= s->ybase + position)
2915 position = s->y + s->height - 1; 2915 position = (s->height - 1) - (s->ybase - s->y);
2916 if (s->y + s->height < s->ybase + position + thickness) 2916 if (s->y + s->height < s->ybase + position + thickness)
2917 thickness = (s->y + s->height) - (s->ybase + position); 2917 thickness = (s->y + s->height) - (s->ybase + position);
2918 s->underline_thickness = thickness; 2918 s->underline_thickness = thickness;
2919 s->underline_position =position; 2919 s->underline_position =position;
2920 y = s->ybase + position; 2920 y = s->ybase + position;