{
/* Draw underline. */
if (s->face->underline_p)
-- {
-- unsigned long thickness, position;
-- int y;
--
-- if (s->prev && s->prev->face->underline_p)
-- {
-- /* We use the same underline style as the previous one. */
-- thickness = s->prev->underline_thickness;
-- position = s->prev->underline_position;
-- }
-- else
-- {
-- /* Get the underline thickness. Default is 1 pixel. */
-- if (s->font && s->font->underline_thickness > 0)
-- thickness = s->font->underline_thickness;
-- else
-- thickness = 1;
-- if (x_underline_at_descent_line)
-- position = (s->height - thickness) - (s->ybase - s->y);
-- else
-- {
-- /* Get the underline position. This is the recommended
-- vertical offset in pixels from the baseline to the top of
-- the underline. This is a signed value according to the
-- specs, and its default is
--
-- ROUND ((maximum descent) / 2), with
-- ROUND(x) = floor (x + 0.5) */
--
-- if (x_use_underline_position_properties
-- && s->font && s->font->underline_position >= 0)
-- position = s->font->underline_position;
-- else if (s->font)
-- position = (s->font->descent + 1) / 2;
-- else
-- position = underline_minimum_offset;
-- }
-- position = max (position, underline_minimum_offset);
-- }
-- /* 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->height - 1) - (s->ybase - s->y);
-- 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;
-- if (s->face->underline_defaulted_p)
-- XFillRectangle (s->display, s->window, s->gc,
-- s->x, y, s->width, thickness);
-- else
-- {
-- XGCValues xgcv;
-- XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
-- XSetForeground (s->display, s->gc, s->face->underline_color);
-- XFillRectangle (s->display, s->window, s->gc,
-- s->x, y, s->width, thickness);
-- XSetForeground (s->display, s->gc, xgcv.foreground);
-- }
-- }
-
++ {
++ if (s->face->underline_type == FACE_UNDER_WAVE)
++ {
++ if (s->face->underline_defaulted_p)
++ x_draw_underwave (s);
++ else
++ {
++ XGCValues xgcv;
++ XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
++ XSetForeground (s->display, s->gc, s->face->underline_color);
++ x_draw_underwave (s);
++ XSetForeground (s->display, s->gc, xgcv.foreground);
++ }
++ }
++ else if (s->face->underline_type == FACE_UNDER_LINE)
++ {
++ unsigned long thickness, position;
++ int y;
+
++ if (s->prev && s->prev->face->underline_p)
++ {
++ /* We use the same underline style as the previous one. */
++ thickness = s->prev->underline_thickness;
++ position = s->prev->underline_position;
++ }
++ else
++ {
++ /* Get the underline thickness. Default is 1 pixel. */
++ if (s->font && s->font->underline_thickness > 0)
++ thickness = s->font->underline_thickness;
++ else
++ thickness = 1;
++ if (x_underline_at_descent_line)
++ position = (s->height - thickness) - (s->ybase - s->y);
++ else
++ {
++ /* Get the underline position. This is the recommended
++ vertical offset in pixels from the baseline to the top of
++ the underline. This is a signed value according to the
++ specs, and its default is
++
++ ROUND ((maximum descent) / 2), with
++ ROUND(x) = floor (x + 0.5) */
++
++ if (x_use_underline_position_properties
++ && s->font && s->font->underline_position >= 0)
++ position = s->font->underline_position;
++ else if (s->font)
++ position = (s->font->descent + 1) / 2;
++ else
++ position = underline_minimum_offset;
++ }
++ position = max (position, underline_minimum_offset);
++ }
++ /* 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->height - 1) - (s->ybase - s->y);
++ 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;
++ if (s->face->underline_defaulted_p)
++ XFillRectangle (s->display, s->window, s->gc,
++ s->x, y, s->width, thickness);
++ else
++ {
++ XGCValues xgcv;
++ XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
++ XSetForeground (s->display, s->gc, s->face->underline_color);
++ XFillRectangle (s->display, s->window, s->gc,
++ s->x, y, s->width, thickness);
++ XSetForeground (s->display, s->gc, xgcv.foreground);
++ }
++ }
++ }
/* Draw overline. */
if (s->face->overline_p)
{