1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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'.
This commit is contained in:
Po Lu 2022-01-10 19:26:46 +08:00
parent e36f076eb7
commit 4f50d964e5
9 changed files with 106 additions and 26 deletions

View file

@ -141,7 +141,12 @@
(const :format "" :value :style)
(choice :tag "Style"
(const :tag "Line" line)
(const :tag "Wave" wave))))
(const :tag "Wave" wave))
(const :format "" :value :position)
(choice :tag "Position"
(const :tag "At Default Position" nil)
(const :tag "At Bottom Of Text" t)
(integer :tag "Pixels Above Bottom Of Text"))))
;; filter to make value suitable for customize
(lambda (real-value)
(and real-value
@ -151,18 +156,21 @@
'foreground-color))
(style
(or (and (consp real-value) (plist-get real-value :style))
'line)))
(list :color color :style style))))
'line))
(position (and (consp real-value)
(plist-get real-value :style))))
(list :color color :style style :position position))))
;; filter to make customized-value suitable for storing
(lambda (cus-value)
(and cus-value
(let ((color (plist-get cus-value :color))
(style (plist-get cus-value :style)))
(cond ((eq style 'line)
(style (plist-get cus-value :style))
(position (plist-get cus-value :position)))
(cond ((and (eq style 'line) (not position))
;; Use simple value for default style
(if (eq color 'foreground-color) t color))
(t
`(:color ,color :style ,style)))))))
`(:color ,color :style ,style :position ,position)))))))
(:overline
(choice :tag "Overline"