From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: mohkale@kisara.moe Newsgroups: gmane.emacs.bugs Subject: bug#62994: [PATCH v4 1/3] Add face definitions for more underline styles Date: Sun, 11 Feb 2024 17:15:54 +0000 Message-ID: <20240211171556.597236-2-mohkale@kisara.moe> References: <20240211171556.597236-1-mohkale@kisara.moe> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10933"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mohsin Kaleem To: 62994@debbugs.gnu.org, Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 11 18:23:59 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rZDYd-0002fu-H8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Feb 2024 18:23:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZDYR-0001NP-Gv; Sun, 11 Feb 2024 12:23:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZDYQ-0001N7-29 for bug-gnu-emacs@gnu.org; Sun, 11 Feb 2024 12:23:46 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZDYP-0004H1-Qf for bug-gnu-emacs@gnu.org; Sun, 11 Feb 2024 12:23:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZDYg-0000Lh-3v for bug-gnu-emacs@gnu.org; Sun, 11 Feb 2024 12:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: mohkale@kisara.moe Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Feb 2024 17:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62994 X-GNU-PR-Package: emacs Original-Received: via spool by 62994-submit@debbugs.gnu.org id=B62994.17076722091259 (code B ref 62994); Sun, 11 Feb 2024 17:24:02 +0000 Original-Received: (at 62994) by debbugs.gnu.org; 11 Feb 2024 17:23:29 +0000 Original-Received: from localhost ([127.0.0.1]:33400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZDY8-0000KF-I1 for submit@debbugs.gnu.org; Sun, 11 Feb 2024 12:23:29 -0500 Original-Received: from 119.ip-51-38-65.eu ([51.38.65.119]:42464 helo=mail.kisara.moe) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZDY7-0000K1-I0 for 62994@debbugs.gnu.org; Sun, 11 Feb 2024 12:23:28 -0500 Original-Received: from mk-desktop.Home (05408574.skybroadband.com [5.64.133.116]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mail.kisara.moe (Postfix) with ESMTPSA id 93DD6A2797; Sun, 11 Feb 2024 18:16:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kisara.moe; s=default; t=1707671766; bh=qa8s19TW7PHkAioyt2dFkPPKP42fEL/FW+SjAYYh/qk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bN9ZsSdRb7o9Lsja4RH0uUvDye8EOcBs9GHYy6ydHRN8mxXTOUx/MPHIOgiRtdsbe oi9T3IrMXqBdk1iIAd2qe9LisfmOEK1SOAHzDmUH/gRRRBmMcdTZD8OxWPvCBXXyQ1 ueSBsuiYmYelbEAFR+6O97gLyioY8dABOWNE6Ob6SFwoBsz+6dLfH0Jl7HQm7hLGxV +9vPMIVz0/fnuaSHy4RojO2xIF8thZMupYJnx2X3TsX1xIRJcPnXu/HAwYjq597nwH l9Q/NORiO083OJlqCc4Ek/0aSi5Rrnb2Z6dRmPFuLh6EjLrVB1B9mk9o9ZdEOerqFe A17U1HHxzNYZA== X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240211171556.597236-1-mohkale@kisara.moe> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279854 Archived-At: From: Mohsin Kaleem * 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