comparison src/xterm.c @ 95791:82a0e6885715

* 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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 10 Jun 2008 20:01:54 +0000
parents 4390d64d3328
children 953225ddde83
comparison
equal deleted inserted replaced
95790:a486132d892c 95791:82a0e6885715
180 int x_use_underline_position_properties; 180 int x_use_underline_position_properties;
181 181
182 /* Non-zero means to draw the underline at the same place as the descent line. */ 182 /* Non-zero means to draw the underline at the same place as the descent line. */
183 183
184 int x_underline_at_descent_line; 184 int x_underline_at_descent_line;
185
186 /* Require underline to be at least this many screen pixels below baseline
187 This to avoid underline "merging" with the base of letters at small
188 font sizes, particularly when x_use_underline_position_properties is on. */
189
190 int x_underline_minimum_display_offset;
185 191
186 /* This is a chain of structures for all the X displays currently in 192 /* This is a chain of structures for all the X displays currently in
187 use. */ 193 use. */
188 194
189 struct x_display_info *x_display_list; 195 struct x_display_info *x_display_list;
2742 && s->font && s->font->underline_position >= 0) 2748 && s->font && s->font->underline_position >= 0)
2743 position = s->font->underline_position; 2749 position = s->font->underline_position;
2744 else if (s->font) 2750 else if (s->font)
2745 position = (s->font->descent + 1) / 2; 2751 position = (s->font->descent + 1) / 2;
2746 } 2752 }
2753 if (x_underline_minimum_display_offset)
2754 position = max (position, eabs (x_underline_minimum_display_offset));
2747 } 2755 }
2748 /* Check the sanity of thickness and position. We should 2756 /* Check the sanity of thickness and position. We should
2749 avoid drawing underline out of the current line area. */ 2757 avoid drawing underline out of the current line area. */
2750 if (s->y + s->height <= s->ybase + position) 2758 if (s->y + s->height <= s->ybase + position)
2751 position = (s->height - 1) - (s->ybase - s->y); 2759 position = (s->height - 1) - (s->ybase - s->y);
10779 DEFVAR_BOOL ("x-use-underline-position-properties", 10787 DEFVAR_BOOL ("x-use-underline-position-properties",
10780 &x_use_underline_position_properties, 10788 &x_use_underline_position_properties,
10781 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. 10789 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
10782 A value of nil means ignore them. If you encounter fonts with bogus 10790 A value of nil means ignore them. If you encounter fonts with bogus
10783 UNDERLINE_POSITION font properties, for example 7x13 on XFree prior 10791 UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
10784 to 4.1, set this to nil. */); 10792 to 4.1, set this to nil. Variable `x-underline-minimum-display-offset' may
10793 be used to override the font's UNDERLINE_POSITION for small font display
10794 sizes. */);
10785 x_use_underline_position_properties = 1; 10795 x_use_underline_position_properties = 1;
10786 10796
10787 DEFVAR_BOOL ("x-underline-at-descent-line", 10797 DEFVAR_BOOL ("x-underline-at-descent-line",
10788 &x_underline_at_descent_line, 10798 &x_underline_at_descent_line,
10789 doc: /* *Non-nil means to draw the underline at the same place as the descent line. 10799 doc: /* *Non-nil means to draw the underline at the same place as the descent line.
10790 A value of nil means to draw the underline according to the value of the 10800 A value of nil means to draw the underline according to the value of the
10791 variable `x-use-underline-position-properties', which is usually at the 10801 variable `x-use-underline-position-properties', which is usually at the
10792 baseline level. The default value is nil. */); 10802 baseline level. The default value is nil. */);
10793 x_underline_at_descent_line = 0; 10803 x_underline_at_descent_line = 0;
10804
10805 DEFVAR_INT ("x-underline-minimum-display-offset",
10806 &x_underline_minimum_display_offset,
10807 doc: /* *When > 0, underline is drawn at least that many screen pixels below baseline.
10808 This can improve legibility of underlined text at small font sizes,
10809 particularly when using variable `x-use-underline-position-properties'
10810 with fonts that specify an UNDERLINE_POSITION relatively close to the
10811 baseline. The default value is 0. */);
10812 x_underline_minimum_display_offset = 0;
10813
10794 10814
10795 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", 10815 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
10796 &x_mouse_click_focus_ignore_position, 10816 &x_mouse_click_focus_ignore_position,
10797 doc: /* Non-nil means that a mouse click to focus a frame does not move point. 10817 doc: /* Non-nil means that a mouse click to focus a frame does not move point.
10798 This variable is only used when the window manager requires that you 10818 This variable is only used when the window manager requires that you