unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: mohkale@kisara.moe
To: 62994@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Cc: Mohsin Kaleem <mohkale@kisara.moe>
Subject: bug#62994: [PATCH v4 1/3] Add face definitions for more underline styles
Date: Sun, 11 Feb 2024 17:15:54 +0000	[thread overview]
Message-ID: <20240211171556.597236-2-mohkale@kisara.moe> (raw)
In-Reply-To: <20240211171556.597236-1-mohkale@kisara.moe>

From: Mohsin Kaleem <mohkale@kisara.moe>

* src/dispextern.h (face_underline_type, syms_of_xfacse,
internal-set-lisp-face-attribute, gui_supports_face_attributes_p):
Add definitions for new underline styles of Double, Dotted and Dashed.
* lisp/cus-face.el (custom-face-attributes): Add entries for Double,
Dotted and Dashed so they can be set through `customize'.
---
 lisp/cus-face.el |  5 ++++-
 src/dispextern.h |  8 ++++++--
 src/xfaces.c     | 21 ++++++++++++++++++++-
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 47afa841f5e..12551e37785 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -141,7 +141,10 @@ custom-face-attributes
 		   (const :format "" :value :style)
 		   (choice :tag "Style"
 			   (const :tag "Line" line)
-			   (const :tag "Wave" wave))
+			   (const :tag "Double" double)
+			   (const :tag "Wave" wave)
+			   (const :tag "Dotted" dotted)
+			   (const :tag "Dashed" dashed))
                    (const :format "" :value :position)
                    (choice :tag "Position"
                            (const :tag "At Default Position" nil)
diff --git a/src/dispextern.h b/src/dispextern.h
index 5387cb45603..470d2eea3ae 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1690,9 +1690,13 @@ #define FONT_TOO_HIGH(ft)						\
 
 enum face_underline_type
 {
+  // Note: Order matches the order of the Smulx terminfo extension.
   FACE_NO_UNDERLINE = 0,
   FACE_UNDER_LINE,
-  FACE_UNDER_WAVE
+  FACE_DOUBLE_UNDER_LINE,
+  FACE_UNDER_WAVE,
+  FACE_DOTTED_UNDER_LINE,
+  FACE_DASHED_UNDER_LINE,
 };
 
 /* Structure describing a realized face.
@@ -1776,7 +1780,7 @@ #define FONT_TOO_HIGH(ft)						\
   ENUM_BF (face_box_type) box : 2;
 
   /* Style of underlining. */
-  ENUM_BF (face_underline_type) underline : 2;
+  ENUM_BF (face_underline_type) underline : 3;
 
   /* If `box' above specifies a 3D type, true means use box_color for
      drawing shadows.  */
diff --git a/src/xfaces.c b/src/xfaces.c
index a558e7328c0..a76a9365b8a 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3311,7 +3311,11 @@ DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute,
                 }
 
               else if (EQ (key, QCstyle)
-                       && !(EQ (val, Qline) || EQ (val, Qwave)))
+                       && !(EQ (val, Qline) ||
+                            EQ (val, Qdouble) ||
+                            EQ (val, Qwave) ||
+                            EQ (val, Qdotted) ||
+                            EQ (val, Qdashed)))
                 {
                   valid_p = false;
                   break;
@@ -5266,6 +5270,7 @@ gui_supports_face_attributes_p (struct frame *f,
                                 Lisp_Object attrs[LFACE_VECTOR_SIZE],
                                 struct face *def_face)
 {
+  Lisp_Object val;
   Lisp_Object *def_attrs = def_face->lface;
   Lisp_Object lattrs[LFACE_VECTOR_SIZE];
 
@@ -5360,6 +5365,17 @@ gui_supports_face_attributes_p (struct frame *f,
       return false;
     }
 
+  /* Check supported underline styles. */
+  val = attrs[LFACE_UNDERLINE_INDEX];
+  if (!UNSPECIFIEDP (val)) {
+    if (EQ (CAR_SAFE (val), QCstyle)) {
+      if (!(EQ (CAR_SAFE (CDR_SAFE (val)), Qline) ||
+            EQ (CAR_SAFE (CDR_SAFE (val)), Qwave))) {
+        return false; /* Unsupported underline style */
+      }
+    }
+  }
+
   /* Everything checks out, this face is supported.  */
   return true;
 }
@@ -7229,6 +7245,9 @@ syms_of_xfaces (void)
   DEFSYM (QCposition, ":position");
   DEFSYM (Qline, "line");
   DEFSYM (Qwave, "wave");
+  DEFSYM (Qdouble, "double");
+  DEFSYM (Qdotted, "dotted");
+  DEFSYM (Qdashed, "dashed");
   DEFSYM (Qreleased_button, "released-button");
   DEFSYM (Qpressed_button, "pressed-button");
   DEFSYM (Qflat_button, "flat-button");
-- 
2.43.0






  reply	other threads:[~2024-02-11 17:15 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 14:29 bug#62994: Support styled underlines on TTY frames Mohsin Kaleem
2024-02-11 17:15 ` bug#62994: [PATCH v4 0/3] Support styled underlines on tty Emacs frames mohkale
2024-02-11 17:15   ` mohkale [this message]
2024-02-11 17:15   ` bug#62994: [PATCH v4 2/3] Add support for styled underlines on tty frames mohkale
2024-02-11 17:15   ` bug#62994: [PATCH v4 3/3] Add support for colored " mohkale
2024-02-11 17:23   ` bug#62994: [PATCH v4 0/3] Support styled underlines on tty Emacs frames Mohsin Kaleem
2024-02-11 17:46     ` Eli Zaretskii
     [not found] ` <handler.62994.B.168208734930664.ack@debbugs.gnu.org>
2023-04-21 14:34   ` bug#62994: [PATCH " mohkale
2023-04-21 14:34     ` bug#62994: [PATCH 1/3] Add face definitions for more underline styles mohkale
2023-04-21 15:58       ` Eli Zaretskii
2023-04-21 16:08         ` Mohsin Kaleem
2023-04-21 14:34     ` bug#62994: [PATCH 2/3] Add support for styled underlines on tty frames mohkale
2023-04-21 16:07       ` Eli Zaretskii
     [not found]         ` <878rel5fqr.fsf@kisara.moe>
2023-04-21 17:49           ` Eli Zaretskii
2023-04-21 18:04             ` Mohsin Kaleem
2023-04-21 18:43               ` Mohsin Kaleem
2023-04-22  7:00                 ` Eli Zaretskii
2023-04-22  9:32                   ` Mohsin Kaleem
2023-04-22  6:47               ` Eli Zaretskii
2023-04-22  9:57                 ` Mohsin Kaleem
2023-04-21 14:34     ` bug#62994: [PATCH 3/3] Add support for colored " mohkale
2023-04-21 16:12       ` Eli Zaretskii
     [not found]         ` <875y9p5fg0.fsf@kisara.moe>
2023-04-21 17:56           ` Eli Zaretskii
2023-04-21 15:52     ` bug#62994: [PATCH 0/3] Support styled underlines on tty Emacs frames Eli Zaretskii
2023-04-21 16:10       ` Mohsin Kaleem
2023-04-21 19:24   ` bug#62994: [PATCH v2 0/1] " mohkale
2023-04-21 19:24     ` bug#62994: [PATCH v2 1/1] Add support for colored and styled underlines on tty frames mohkale
2023-04-24  9:21       ` Robert Pluim
2023-04-22 10:21   ` bug#62994: [PATCH v3 0/1] Support styled underlines on tty Emacs frames mohkale
2023-04-22 10:21     ` bug#62994: [PATCH v3 1/1] Add support for colored and styled underlines on tty frames mohkale
2024-02-12  1:28       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-28 11:30     ` bug#62994: [PATCH v3 0/1] Support styled underlines on tty Emacs frames Mohsin Kaleem
2024-01-28 12:05       ` Eli Zaretskii
     [not found]         ` <86fryg62kh.fsf@kisara.moe>
2024-01-29 12:37           ` Eli Zaretskii
2024-02-11 17:40   ` bug#62994: [PATCH v4] Add support for colored and styled underlines on tty frames mohkale
2024-02-11 18:05   ` bug#62994: [PATCH v5] " mohkale
2024-02-11 18:07     ` Mohsin Kaleem
2024-02-12  1:43     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-12 13:50       ` Eli Zaretskii
2024-02-12 14:49         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-10 17:20           ` Mohsin Kaleem
2024-03-10 17:15       ` Mohsin Kaleem
2024-03-10 17:45         ` Eli Zaretskii
2024-03-10 18:22           ` Mohsin Kaleem
2024-03-10 18:51             ` Jim Porter
2024-03-10 19:28               ` Eli Zaretskii
2024-03-10 19:47                 ` Jim Porter
2024-03-11  2:07                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-10 19:27             ` Eli Zaretskii
2024-02-12 12:48     ` Eli Zaretskii
2024-03-10 18:08       ` Mohsin Kaleem
2024-03-14 10:20         ` Eli Zaretskii
2024-02-14 19:40     ` Jim Porter
2024-03-10 18:10       ` Mohsin Kaleem
2024-04-14 13:56   ` bug#62994: [PATCH v6] " mohkale
2024-04-14 14:13     ` Mohsin Kaleem
2024-04-20  8:16     ` Eli Zaretskii
2024-04-21 14:51       ` Mohsin Kaleem
2024-04-21 15:57         ` Eli Zaretskii
2024-04-21 16:09           ` Mohsin Kaleem
2024-04-21 16:11   ` bug#62994: [PATCH v7] " Mohsin Kaleem
2024-04-22  0:44     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22  6:01       ` Eli Zaretskii
2024-04-22 17:35         ` Jim Porter
2024-04-23  0:53         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-23  6:02           ` Eli Zaretskii
2024-04-23  7:32             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 17:52       ` Mohsin Kaleem
2024-04-22 17:53   ` bug#62994: [PATCH v8] " Mohsin Kaleem
2024-04-27  9:11     ` Eli Zaretskii
2024-04-29  1:04       ` Jim Porter
2024-04-29  4:52         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29  7:25           ` Eli Zaretskii
2024-04-29 11:36             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29  7:10         ` Eli Zaretskii
2024-04-30 17:53       ` Mohsin Kaleem
2024-04-30 18:20         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240211171556.597236-2-mohkale@kisara.moe \
    --to=mohkale@kisara.moe \
    --cc=62994@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).