summaryrefslogtreecommitdiff
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-01-10 19:26:46 +0800
committerPo Lu <luangruo@yahoo.com>2022-01-10 19:26:46 +0800
commit4f50d964e51bbe5219f40df4353f4314c7ade985 (patch)
tree8c68be6ee5b0b9999bb61ed7dd3553b456828b7b /src/xfaces.c
parente36f076eb7681e32b3b0cc61c4fd33e448e3bc74 (diff)
downloademacs-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/xfaces.c')
-rw-r--r--src/xfaces.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 3fd31b7f225..8064d47c947 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6041,6 +6041,8 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
face->underline = FACE_UNDER_LINE;
face->underline_defaulted_p = true;
face->underline_color = 0;
+ face->underline_at_descent_line_p = false;
+ face->underline_pixels_above_descent_line = 0;
}
else if (STRINGP (underline))
{
@@ -6050,12 +6052,16 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
face->underline_color
= load_color (f, face, underline,
LFACE_UNDERLINE_INDEX);
+ face->underline_at_descent_line_p = false;
+ face->underline_pixels_above_descent_line = 0;
}
else if (NILP (underline))
{
face->underline = FACE_NO_UNDERLINE;
face->underline_defaulted_p = false;
face->underline_color = 0;
+ face->underline_at_descent_line_p = false;
+ face->underline_pixels_above_descent_line = 0;
}
else if (CONSP (underline))
{
@@ -6064,6 +6070,8 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
face->underline = FACE_UNDER_LINE;
face->underline_color = 0;
face->underline_defaulted_p = true;
+ face->underline_at_descent_line_p = false;
+ face->underline_pixels_above_descent_line = 0;
/* FIXME? This is also not robust about checking the precise form.
See comments in Finternal_set_lisp_face_attribute. */
@@ -6100,6 +6108,13 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
else if (EQ (value, Qwave))
face->underline = FACE_UNDER_WAVE;
}
+ else if (EQ (keyword, QCposition))
+ {
+ face->underline_at_descent_line_p = !NILP (value);
+
+ if (FIXNATP (value))
+ face->underline_pixels_above_descent_line = XFIXNAT (value);
+ }
}
}
@@ -6915,6 +6930,7 @@ syms_of_xfaces (void)
DEFSYM (QCcolor, ":color");
DEFSYM (QCline_width, ":line-width");
DEFSYM (QCstyle, ":style");
+ DEFSYM (QCposition, ":position");
DEFSYM (Qline, "line");
DEFSYM (Qwave, "wave");
DEFSYM (Qreleased_button, "released-button");