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 1/3] Add face definitions for more underline styles Date: Fri, 21 Apr 2023 15:34:46 +0100 Message-ID: <20230421143448.339022-2-mohkale@kisara.moe> References: <20230421143448.339022-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="34620"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mohsin Kaleem To: 62994@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 21 16:35:44 2023 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 1pprrT-0008ok-HO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Apr 2023 16:35:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pprr4-0005nT-Sj; Fri, 21 Apr 2023 10:35:18 -0400 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 1pprqp-0005d7-7P for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 10:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pprqo-0001GI-Ua for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 10:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pprqo-00028Z-QT for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 10:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: mohkale@kisara.moe Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Apr 2023 14:35: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.16820877018183 (code B ref 62994); Fri, 21 Apr 2023 14:35:02 +0000 Original-Received: (at 62994) by debbugs.gnu.org; 21 Apr 2023 14:35:01 +0000 Original-Received: from localhost ([127.0.0.1]:40898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pprqm-00027p-Mr for submit@debbugs.gnu.org; Fri, 21 Apr 2023 10:35:01 -0400 Original-Received: from 119.ip-51-38-65.eu ([51.38.65.119]:50922 helo=mail.kisara.moe) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pprqk-00027K-DF for 62994@debbugs.gnu.org; Fri, 21 Apr 2023 10:34:58 -0400 Original-Received: from localhost.localdomain (unknown [146.70.132.151]) (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 EF084A0FFD; Fri, 21 Apr 2023 16:34:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kisara.moe; s=default; t=1682087697; bh=MACAnbePtzTXRa64Wk+6bZen9m50SG7jCDxm0mEHB3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NkLO6Zq5ITdE6XuUooHs0DImO3YYZIVkzSLeJL6b1d/sdB0Desd3dyRjT+8sn2k34 LspsUXoRu16BjSNHEwZFFu0lt8VhcopCdK/ooefDCMT+KanT6su4HzeJXQRMSVRceP +kRra1Hf29KuuLPSvOYp7JuO3pQXnNrc2NGQEHax+tkXeiWxMaNYqxlOm99xiMikKv ZDc0immIHcCure5MyAWsrKavGo1k/t2AGYpeUjHzJJepwqtEDsygPqDz2ItkyNIyhs o7mMtSTAgkVr3r5oiICIqGusk5cgsdH+2CFRQ/NNkqKCyZXyV5r+OPZ0NZEuAkXmZz QMSR2XphbzHyw== X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230421143448.339022-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:260392 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 ec89b4f7ff6..2d6e6c7b73e 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 4dcab113ea2..1dc84e32efc 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1653,9 +1653,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. @@ -1737,7 +1741,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 37b703984be..cfbb89d2ae2 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3255,7 +3255,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; @@ -5204,6 +5208,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]; @@ -5298,6 +5303,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; } @@ -7165,6 +7181,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.40.0