diff options
author | Po Lu <luangruo@yahoo.com> | 2022-01-10 19:26:46 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-01-10 19:26:46 +0800 |
commit | 4f50d964e51bbe5219f40df4353f4314c7ade985 (patch) | |
tree | 8c68be6ee5b0b9999bb61ed7dd3553b456828b7b /src/w32term.c | |
parent | e36f076eb7681e32b3b0cc61c4fd33e448e3bc74 (diff) | |
download | emacs-4f50d964e51bbe5219f40df4353f4314c7ade985.tar.gz |
Allow controlling the underline position of faces
* doc/lispref/display.texi (Face Attributes): Document new
`:position' property of the `:underline' attribute.
* etc/NEWS: Announce new property.
* lisp/cus-face.el (custom-face-attributes): Implement
customization for new face attribute.
* src/dispextern.h (struct face): New fields
`underline_pixels_above_descent_line' and
`underline_at_descent_line_p'.
* src/haikuterm.c (haiku_draw_text_decoration):
* src/nsterm.m (ns_draw_text_decoration):
* src/w32term.c (w32_draw_glyph_string):
* src/xterm.c (x_draw_glyph_string): Respect new face fields.
* src/xfaces.c (realize_gui_face): Handle new `:position'
keyword.
(syms_of_xfaces): New symbol `:position'.
Diffstat (limited to 'src/w32term.c')
-rw-r--r-- | src/w32term.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/w32term.c b/src/w32term.c index 700c492cc37..78777f153c0 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2564,7 +2564,11 @@ w32_draw_glyph_string (struct glyph_string *s) int y; if (s->prev - && s->prev->face->underline == FACE_UNDER_LINE) + && s->prev->face->underline == FACE_UNDER_LINE + && (s->prev->face->underline_at_descent_line_p + == s->face->underline_at_descent_line_p) + && (s->prev->face->underline_pixels_above_descent_line + == s->face->underline_pixels_above_descent_line)) { /* We use the same underline style as the previous one. */ thickness = s->prev->underline_thickness; @@ -2587,7 +2591,8 @@ w32_draw_glyph_string (struct glyph_string *s) val = (WINDOW_BUFFER_LOCAL_VALUE (Qx_underline_at_descent_line, s->w)); underline_at_descent_line - = !(NILP (val) || EQ (val, Qunbound)); + = (!(NILP (val) || EQ (val, Qunbound)) + || s->face->underline_at_descent_line_p); val = (WINDOW_BUFFER_LOCAL_VALUE (Qx_use_underline_position_properties, s->w)); @@ -2601,7 +2606,9 @@ w32_draw_glyph_string (struct glyph_string *s) thickness = 1; if (underline_at_descent_line || !font) - position = (s->height - thickness) - (s->ybase - s->y); + position = ((s->height - thickness) + - (s->ybase - s->y) + - s->face->underline_pixels_above_descent_line); else { /* Get the underline position. This is the @@ -2619,7 +2626,12 @@ w32_draw_glyph_string (struct glyph_string *s) else position = (font->descent + 1) / 2; } - position = max (position, minimum_offset); + + if (!(s->face->underline_at_descent_line_p + /* Ignore minimum_offset if the amount of pixels + was explictly specified. */ + && s->face->underline_pixels_above_descent_line)) + position = max (position, minimum_offset); } /* Check the sanity of thickness and position. We should avoid drawing underline out of the current line area. */ |