diff options
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/xterm.c b/src/xterm.c index 0d25c7f1a26..db5ea4ac55e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3707,33 +3707,53 @@ x_draw_glyph_string (struct glyph_string *s) | |||
| 3707 | else | 3707 | else |
| 3708 | { | 3708 | { |
| 3709 | struct font *font = font_for_underline_metrics (s); | 3709 | struct font *font = font_for_underline_metrics (s); |
| 3710 | unsigned long minimum_offset; | ||
| 3711 | bool underline_at_descent_line; | ||
| 3712 | bool use_underline_position_properties; | ||
| 3713 | Lisp_Object val | ||
| 3714 | = buffer_local_value (Qunderline_minimum_offset, | ||
| 3715 | s->w->contents); | ||
| 3716 | if (INTEGERP (val)) | ||
| 3717 | minimum_offset = XFASTINT (val); | ||
| 3718 | else | ||
| 3719 | minimum_offset = 1; | ||
| 3720 | val = buffer_local_value (Qx_underline_at_descent_line, | ||
| 3721 | s->w->contents); | ||
| 3722 | underline_at_descent_line | ||
| 3723 | = !(NILP (val) || EQ (val, Qunbound)); | ||
| 3724 | val | ||
| 3725 | = buffer_local_value (Qx_use_underline_position_properties, | ||
| 3726 | s->w->contents); | ||
| 3727 | use_underline_position_properties | ||
| 3728 | = !(NILP (val) || EQ (val, Qunbound)); | ||
| 3710 | 3729 | ||
| 3711 | /* Get the underline thickness. Default is 1 pixel. */ | 3730 | /* Get the underline thickness. Default is 1 pixel. */ |
| 3712 | if (font && font->underline_thickness > 0) | 3731 | if (font && font->underline_thickness > 0) |
| 3713 | thickness = font->underline_thickness; | 3732 | thickness = font->underline_thickness; |
| 3714 | else | 3733 | else |
| 3715 | thickness = 1; | 3734 | thickness = 1; |
| 3716 | if (x_underline_at_descent_line) | 3735 | if (underline_at_descent_line) |
| 3717 | position = (s->height - thickness) - (s->ybase - s->y); | 3736 | position = (s->height - thickness) - (s->ybase - s->y); |
| 3718 | else | 3737 | else |
| 3719 | { | 3738 | { |
| 3720 | /* Get the underline position. This is the recommended | 3739 | /* Get the underline position. This is the |
| 3721 | vertical offset in pixels from the baseline to the top of | 3740 | recommended vertical offset in pixels from |
| 3722 | the underline. This is a signed value according to the | 3741 | the baseline to the top of the underline. |
| 3742 | This is a signed value according to the | ||
| 3723 | specs, and its default is | 3743 | specs, and its default is |
| 3724 | 3744 | ||
| 3725 | ROUND ((maximum descent) / 2), with | 3745 | ROUND ((maximum descent) / 2), with |
| 3726 | ROUND(x) = floor (x + 0.5) */ | 3746 | ROUND(x) = floor (x + 0.5) */ |
| 3727 | 3747 | ||
| 3728 | if (x_use_underline_position_properties | 3748 | if (use_underline_position_properties |
| 3729 | && font && font->underline_position >= 0) | 3749 | && font && font->underline_position >= 0) |
| 3730 | position = font->underline_position; | 3750 | position = font->underline_position; |
| 3731 | else if (font) | 3751 | else if (font) |
| 3732 | position = (font->descent + 1) / 2; | 3752 | position = (font->descent + 1) / 2; |
| 3733 | else | 3753 | else |
| 3734 | position = underline_minimum_offset; | 3754 | position = minimum_offset; |
| 3735 | } | 3755 | } |
| 3736 | position = max (position, underline_minimum_offset); | 3756 | position = max (position, minimum_offset); |
| 3737 | } | 3757 | } |
| 3738 | /* Check the sanity of thickness and position. We should | 3758 | /* Check the sanity of thickness and position. We should |
| 3739 | avoid drawing underline out of the current line area. */ | 3759 | avoid drawing underline out of the current line area. */ |
| @@ -13246,6 +13266,8 @@ UNDERLINE_POSITION font properties, set this to nil. You can also use | |||
| 13246 | `underline-minimum-offset' to override the font's UNDERLINE_POSITION for | 13266 | `underline-minimum-offset' to override the font's UNDERLINE_POSITION for |
| 13247 | small font display sizes. */); | 13267 | small font display sizes. */); |
| 13248 | x_use_underline_position_properties = true; | 13268 | x_use_underline_position_properties = true; |
| 13269 | DEFSYM (Qx_use_underline_position_properties, | ||
| 13270 | "x-use-underline-position-properties"); | ||
| 13249 | 13271 | ||
| 13250 | DEFVAR_BOOL ("x-underline-at-descent-line", | 13272 | DEFVAR_BOOL ("x-underline-at-descent-line", |
| 13251 | x_underline_at_descent_line, | 13273 | x_underline_at_descent_line, |
| @@ -13256,6 +13278,7 @@ A value of nil means to draw the underline according to the value of the | |||
| 13256 | variable `x-use-underline-position-properties', which is usually at the | 13278 | variable `x-use-underline-position-properties', which is usually at the |
| 13257 | baseline level. The default value is nil. */); | 13279 | baseline level. The default value is nil. */); |
| 13258 | x_underline_at_descent_line = false; | 13280 | x_underline_at_descent_line = false; |
| 13281 | DEFSYM (Qx_underline_at_descent_line, "x-underline-at-descent-line"); | ||
| 13259 | 13282 | ||
| 13260 | DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", | 13283 | DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", |
| 13261 | x_mouse_click_focus_ignore_position, | 13284 | x_mouse_click_focus_ignore_position, |