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

Allow negative line width for :box face attribute

Separate values for box line width and height and allow both to be
negative which makes the visual width and height of the boxed string
unchanged (Bug#13011).

* doc/lispref/display.texi (Face Attributes): Modify :box attribute
description to reflect the new possibilities.
* lisp/cus-face.el (custom-face-attributes): Set box attribute to get
two integer to set vertical and horizontal width and modify pre-filter
to accept dotted list of two int as valid box attribute.
* src/dispextern.h (face): Use two int for box horizontal and vertical
line width.

* src/nsfont.m (nsfont_draw): Use new face attributes.
* src/nsterm.m (ns_draw_box, ns_draw_relief): Support separated
horizontal and vertical box line width.
(ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background)
(ns_dumpglyphs_image, ns_draw_glyph_string_foreground)
(ns_draw_composite_glyph_string_foreground): Use new face attributes.

* src/w32term.c (w32_draw_box_rect, w32_draw_relief_rect): Support
separated horizontal and vertical box line width.
(x_draw_glyph_string_background, x_draw_glyph_string_foreground)
(x_draw_composite_glyph_string_foreground)
(x_draw_glyphless_glyph_string_foreground, x_draw_glyph_string_box)
(x_draw_image_foreground, x_draw_image_relief)
(w32_draw_image_foreground_1, x_draw_image_glyph_string): Use new face
attributes.

* src/xfaces.c (Sinternal_set_lisp_face_attribute, realize_x_face):
Accept box attribute as a list of two ints.

* src/xdisp.c (estimate_mode_line_height, produce_image_glyph)
(produce_xwidget_glyph, x_produce_glyphs): Use new face attributes.
* src/xterm.c (x_draw_box_rect, x_draw_relief_rect): Support separated
horizontal and vertical box line width.
(x_draw_glyph_string_background, x_draw_glyph_string_foreground)
(x_draw_composite_glyph_string_foreground)
(x_draw_glyphless_glyph_string_foreground, x_draw_glyph_string_box)
(x_draw_image_foreground, x_draw_image_relief, x_draw_image_foreground_1)
(x_draw_image_glyph_string): Use new face attributes.
This commit is contained in:
Alexandre Adolphe 2019-08-10 22:57:24 +02:00 committed by Noam Postavsky
parent b538cd88b4
commit 34ae2d0c22
9 changed files with 227 additions and 213 deletions

View file

@ -166,9 +166,11 @@
:help-echo "Control box around text."
(const :tag "Off" nil)
(list :tag "Box"
:value (:line-width 2 :color "grey75" :style released-button)
(const :format "" :value :line-width)
(integer :tag "Width")
:value (:line-width (2 . 2) :color "grey75" :style released-button)
(const :format "" :value :line-width)
(cons :tag "Width" :extra-offset 2
(integer :tag "Vertical")
(integer :tag "Horizontal"))
(const :format "" :value :color)
(choice :tag "Color" (const :tag "*" nil) color)
(const :format "" :value :style)
@ -181,15 +183,19 @@
(and real-value
(let ((lwidth
(or (and (consp real-value)
(plist-get real-value :line-width))
(if (listp (cdr real-value))
(plist-get real-value :line-width)
real-value))
(and (integerp real-value) real-value)
1))
'(1 . 1)))
(color
(or (and (consp real-value) (plist-get real-value :color))
(and (stringp real-value) real-value)
nil))
(style
(and (consp real-value) (plist-get real-value :style))))
(if (integerp lwidth)
(setq lwidth (cons (abs lwidth) lwidth)))
(list :line-width lwidth :color color :style style))))
;; filter to make customized-value suitable for storing
(lambda (cus-value)