From d5dc61631e773495e96ed2bbd3bca16c981e9f7e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 10 Jun 2008 20:01:54 +0000 Subject: [PATCH] * xterm.c (x_underline_minimum_display_offset): New var. (x_draw_glyph_string): Use it. (syms_of_xterm): Declare it. * cus-start.el (x-underline-minimum-display-offset): Give it a type. --- lisp/ChangeLog | 4 ++++ lisp/cus-start.el | 1 + src/ChangeLog | 6 ++++++ src/xterm.c | 22 +++++++++++++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 238245be904..2472e3f6112 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2008-06-10 David De La Harpe Golden (tiny change) + + * cus-start.el (x-underline-minimum-display-offset): Give it a type. + 2008-06-10 Chong Yidong * mouse.el (mouse-select-font): New function. diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 582a3f98c6e..73150ce8f7c 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -348,6 +348,7 @@ since it could result in memory overflow and make Emacs crash." ;; xterm.c (x-use-underline-position-properties display boolean "22.1") (x-underline-at-descent-line display boolean "22.1") + (x-underline-minimum-display-offset display integer "23.1") (x-stretch-cursor display boolean "21.1"))) this symbol group type standard version native-p ;; This function turns a value diff --git a/src/ChangeLog b/src/ChangeLog index cfe3885b1f1..2716320139b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-06-10 David De La Harpe Golden (tiny change) + + * xterm.c (x_underline_minimum_display_offset): New var. + (x_draw_glyph_string): Use it. + (syms_of_xterm): Declare it. + 2008-06-10 Chong Yidong * font.c (font_parse_fcname): Accept GTK-style font names too. diff --git a/src/xterm.c b/src/xterm.c index fa7ffe5139e..13c2d2e4a97 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -183,6 +183,12 @@ int x_use_underline_position_properties; int x_underline_at_descent_line; +/* Require underline to be at least this many screen pixels below baseline + This to avoid underline "merging" with the base of letters at small + font sizes, particularly when x_use_underline_position_properties is on. */ + +int x_underline_minimum_display_offset; + /* This is a chain of structures for all the X displays currently in use. */ @@ -2744,6 +2750,8 @@ x_draw_glyph_string (s) else if (s->font) position = (s->font->descent + 1) / 2; } + if (x_underline_minimum_display_offset) + position = max (position, eabs (x_underline_minimum_display_offset)); } /* Check the sanity of thickness and position. We should avoid drawing underline out of the current line area. */ @@ -10781,7 +10789,9 @@ syms_of_xterm () doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. A value of nil means ignore them. If you encounter fonts with bogus UNDERLINE_POSITION font properties, for example 7x13 on XFree prior -to 4.1, set this to nil. */); +to 4.1, set this to nil. Variable `x-underline-minimum-display-offset' may +be used to override the font's UNDERLINE_POSITION for small font display +sizes. */); x_use_underline_position_properties = 1; DEFVAR_BOOL ("x-underline-at-descent-line", @@ -10792,6 +10802,16 @@ variable `x-use-underline-position-properties', which is usually at the baseline level. The default value is nil. */); x_underline_at_descent_line = 0; + DEFVAR_INT ("x-underline-minimum-display-offset", + &x_underline_minimum_display_offset, + doc: /* *When > 0, underline is drawn at least that many screen pixels below baseline. +This can improve legibility of underlined text at small font sizes, +particularly when using variable `x-use-underline-position-properties' +with fonts that specify an UNDERLINE_POSITION relatively close to the +baseline. The default value is 0. */); + x_underline_minimum_display_offset = 0; + + DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", &x_mouse_click_focus_ignore_position, doc: /* Non-nil means that a mouse click to focus a frame does not move point. -- 2.39.2