unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Alan Third <alan@idiocy.org>, Eli Zaretskii <eliz@gnu.org>
Cc: 47074@debbugs.gnu.org
Subject: bug#47074: Replace XPM icons with Unicode codepoints in customize/widgets
Date: Fri, 12 Mar 2021 20:44:55 -0600	[thread overview]
Message-ID: <CADwFkmku9WpSHr1qLCD5q2a02jPxQ35pzfdd3BzSxo6v4jhGSQ@mail.gmail.com> (raw)
In-Reply-To: <YEqsopHeUKuLLYyd@breton.holly.idiocy.org>

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

Alan Third <alan@idiocy.org> writes:

> On Thu, Mar 11, 2021 at 10:01:11PM +0200, Eli Zaretskii wrote:
>> >
>> > I think SVG is obviously much preferable to XPM, but there is still the
>> > problem that the images don't scale with the text.  Do we have a general
>> > solution to that?  If not, should we have one?
>>
>> With SVG, I believe we could.  (We can scale other kinds of images as
>> well, but they don't look well when enlarged, AFAIK.)
>
> I've been thinking about this, and assuming we can extract the font
> name and size from the face in C then we can create a default CSS
> stylesheet that should make 1em in an SVG equivalent to the actual
> Emacs font height.

I took a stab at adding SVG icons, as found in the GNOME Adwaita Icon
Theme.  I had to scrub some color details from the SVG files by hand,
but they now seem to automagically adapt to the :foreground and
:background of the current face (but I could be wrong about that as I
don't understand how this is supposed to work).

How would a patch like the attached relate to the changes you propose,
Alan?

[-- Attachment #2: 0001-Add-SVG-icons-for-customize-buffers.patch --]
[-- Type: text/x-diff, Size: 6394 bytes --]

From 25d8f2a7c136a991098ddefc89ff11d9af722377 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Sat, 13 Mar 2021 03:20:29 +0100
Subject: [PATCH] Add SVG icons for customize buffers

---
 etc/images/ui/README               | 18 ++++++++++++++++++
 etc/images/ui/checkbox-checked.svg |  6 ++++++
 etc/images/ui/checkbox-mixed.svg   |  6 ++++++
 etc/images/ui/checkbox.svg         |  3 +++
 etc/images/ui/radio-checked.svg    |  6 ++++++
 etc/images/ui/radio-mixed.svg      |  6 ++++++
 etc/images/ui/radio.svg            |  3 +++
 lisp/wid-edit.el                   | 10 +++++-----
 8 files changed, 53 insertions(+), 5 deletions(-)
 create mode 100644 etc/images/ui/README
 create mode 100644 etc/images/ui/checkbox-checked.svg
 create mode 100644 etc/images/ui/checkbox-mixed.svg
 create mode 100644 etc/images/ui/checkbox.svg
 create mode 100644 etc/images/ui/radio-checked.svg
 create mode 100644 etc/images/ui/radio-mixed.svg
 create mode 100644 etc/images/ui/radio.svg

diff --git a/etc/images/ui/README b/etc/images/ui/README
new file mode 100644
index 0000000000..f83843d34e
--- /dev/null
+++ b/etc/images/ui/README
@@ -0,0 +1,18 @@
+COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
+
+* The following icons are from the Adwaita Icon Theme (made by the
+GNOME project).  They are not part of Emacs, but are distributed and
+used by Emacs.  They are licensed under either the GNU LGPL v3 or the
+Creative Commons Attribution-Share Alike 3.0 United States License.
+
+To view a copy of the CC-BY-SA licence, visit
+http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
+Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.
+
+For more information see the adwaita-icon-theme repository at:
+
+    https://gitlab.gnome.org/GNOME/adwaita-icon-theme
+
+Emacs images and their source in the Adwaita/scalable directory.
+
+ ... FIXME ...
diff --git a/etc/images/ui/checkbox-checked.svg b/etc/images/ui/checkbox-checked.svg
new file mode 100644
index 0000000000..6fefd5569e
--- /dev/null
+++ b/etc/images/ui/checkbox-checked.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+  <g>
+    <path d="M3.5 1A2.506 2.506 0 001 3.5v9C1 13.876 2.124 15 3.5 15h9c1.376 0 2.5-1.124 2.5-2.5v-9C15 2.124 13.876 1 12.5 1zm0 1h9c.84 0 1.5.66 1.5 1.5v9c0 .84-.66 1.5-1.5 1.5h-9c-.84 0-1.5-.66-1.5-1.5v-9C2 2.66 2.66 2 3.5 2z" overflow="visible" />
+    <path d="M14.5 3l-.5-.5L7.5 9 5 6.5l-2 2L7.5 13l7-7z" overflow="visible" />
+  </g>
+</svg>
diff --git a/etc/images/ui/checkbox-mixed.svg b/etc/images/ui/checkbox-mixed.svg
new file mode 100644
index 0000000000..13bccaa7ce
--- /dev/null
+++ b/etc/images/ui/checkbox-mixed.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+  <g>
+    <path d="M3.5 1A2.506 2.506 0 001 3.5v9C1 13.876 2.124 15 3.5 15h9c1.376 0 2.5-1.124 2.5-2.5v-9C15 2.124 13.876 1 12.5 1zm0 1h9c.84 0 1.5.66 1.5 1.5v9c0 .84-.66 1.5-1.5 1.5h-9c-.84 0-1.5-.66-1.5-1.5v-9C2 2.66 2.66 2 3.5 2z" overflow="visible" />
+    <path d="M5 6a2 2 0 100 4h6a2 2 0 100-4z" overflow="visible" />
+  </g>
+</svg>
diff --git a/etc/images/ui/checkbox.svg b/etc/images/ui/checkbox.svg
new file mode 100644
index 0000000000..18cd25b43f
--- /dev/null
+++ b/etc/images/ui/checkbox.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+  <path d="M3.5 1A2.506 2.506 0 001 3.5v9C1 13.876 2.124 15 3.5 15h9c1.376 0 2.5-1.124 2.5-2.5v-9C15 2.124 13.876 1 12.5 1zm0 1h9c.84 0 1.5.66 1.5 1.5v9c0 .84-.66 1.5-1.5 1.5h-9c-.84 0-1.5-.66-1.5-1.5v-9C2 2.66 2.66 2 3.5 2z" overflow="visible" />
+</svg>
diff --git a/etc/images/ui/radio-checked.svg b/etc/images/ui/radio-checked.svg
new file mode 100644
index 0000000000..db711841cf
--- /dev/null
+++ b/etc/images/ui/radio-checked.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+  <g>
+    <path d="M8 5a3.001 3.001 0 000 6 3.001 3.001 0 000-6z" overflow="visible"/>
+    <path d="M8.004 1C4.144 1 1 4.144 1 8.004c0 3.86 3.144 7.006 7.004 7.006 3.86 0 7.006-3.146 7.006-7.006C15.01 4.144 11.864 1 8.004 1zm0 1a6.002 6.002 0 016.006 6.004 6.004 6.004 0 01-6.006 6.006A6.002 6.002 0 012 8.004 6 6 0 018.004 2z" overflow="visible"/>
+  </g>
+</svg>
diff --git a/etc/images/ui/radio-mixed.svg b/etc/images/ui/radio-mixed.svg
new file mode 100644
index 0000000000..5a8be0cf65
--- /dev/null
+++ b/etc/images/ui/radio-mixed.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+  <g font-weight="400" fill="#474747">
+    <path d="M8 1C4.142 1 1 4.142 1 8s3.142 7 7 7 7-3.142 7-7-3.142-7-7-7zm0 1c3.316 0 6 2.684 6 6s-2.684 6-6 6-6-2.684-6-6 2.684-6 6-6z" overflow="visible" />
+    <path d="M5 6a2 2 0 100 4h6a2 2 0 100-4z" overflow="visible" />
+  </g>
+</svg>
diff --git a/etc/images/ui/radio.svg b/etc/images/ui/radio.svg
new file mode 100644
index 0000000000..0d649c99cd
--- /dev/null
+++ b/etc/images/ui/radio.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+  <path d="M8 1C4.142 1 1 4.142 1 8s3.142 7 7 7 7-3.142 7-7-3.142-7-7-7zm0 1c3.316 0 6 2.684 6 6s-2.684 6-6 6-6-2.684-6-6 2.684-6 6-6z" overflow="visible" />
+</svg>
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index de2b5d4a7c..b8d1fad49c 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -745,7 +745,7 @@ widget-image-enable
   :type 'boolean)
 
 (defcustom widget-image-conversion
-  '((xpm ".xpm") (gif ".gif") (png ".png") (jpeg ".jpg" ".jpeg")
+  '((svg ".svg") (xpm ".xpm") (gif ".gif") (png ".png") (jpeg ".jpg" ".jpeg")
     (xbm ".xbm"))
   "Conversion alist from image formats to file name suffixes."
   :group 'widgets
@@ -2385,9 +2385,9 @@ 'checkbox
   ;; We could probably do the same job as the images using single
   ;; space characters in a boxed face with a stretch specification to
   ;; make them square.
-  :on-glyph "checked"
+  :on-glyph "ui/checkbox-checked"
   :off "[ ]"
-  :off-glyph "unchecked"
+  :off-glyph "ui/checkbox"
   :help-echo "Toggle this item."
   :action 'widget-checkbox-action)
 
@@ -2570,9 +2570,9 @@ 'radio-button
   :button-suffix ""
   :button-prefix ""
   :on "(*)"
-  :on-glyph "radio1"
+  :on-glyph "ui/radio-checked"
   :off "( )"
-  :off-glyph "radio0")
+  :off-glyph "ui/radio")
 
 (defun widget-radio-button-notify (widget _child &optional event)
   ;; Tell daddy.
-- 
2.30.1


  parent reply	other threads:[~2021-03-13  2:44 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 16:51 bug#47074: Replace XPM icons with Unicode codepoints in customize/widgets Stefan Kangas
2021-03-11 17:01 ` Lars Ingebrigtsen
2021-03-11 17:22   ` Stefan Kangas
2021-03-11 17:38   ` Eli Zaretskii
2021-03-11 17:51     ` Stefan Kangas
2021-03-11 19:59       ` Eli Zaretskii
2021-03-11 17:28 ` Eli Zaretskii
2021-03-11 17:51   ` Stefan Kangas
2021-03-11 18:03     ` Lars Ingebrigtsen
2021-03-11 20:21       ` Eli Zaretskii
2021-03-11 20:27         ` Lars Ingebrigtsen
2021-03-12  1:38           ` Stefan Kangas
2021-03-12  1:43             ` Lars Ingebrigtsen
2021-03-12  2:24               ` Stefan Kangas
2021-03-12  2:34                 ` Lars Ingebrigtsen
2021-03-12  8:12             ` Eli Zaretskii
2021-03-11 20:01     ` Eli Zaretskii
2021-03-11 23:49       ` Alan Third
2021-03-12  0:12         ` Lars Ingebrigtsen
2021-03-12 18:21           ` Alan Third
2021-03-12  7:27         ` Eli Zaretskii
2021-03-12 18:25           ` Alan Third
2021-03-12 18:37             ` Eli Zaretskii
2021-03-12 18:43               ` Alan Third
2021-03-12 19:27                 ` Eli Zaretskii
2021-03-13  2:44         ` Stefan Kangas [this message]
2021-03-13  7:29           ` Eli Zaretskii
2021-03-13  7:47             ` Stefan Kangas
2021-03-13  8:37               ` Eli Zaretskii
2021-03-13 10:35                 ` Stefan Kangas
2021-03-13 10:54                   ` Eli Zaretskii
2021-03-13 11:51                     ` Stefan Kangas
2021-03-13 16:27                       ` Eli Zaretskii
2021-03-13 16:44                         ` Stefan Kangas
2021-03-13 17:02                           ` Eli Zaretskii
2021-03-13 20:24           ` Alan Third
2021-03-14 13:46           ` Alan Third
2021-03-14 18:44             ` Stefan Kangas
2021-03-14 18:49               ` Eli Zaretskii
2021-03-14 19:37                 ` Alan Third
2021-03-14 19:52                   ` Eli Zaretskii
2021-03-15 21:34                     ` Alan Third
2021-03-16  3:29                       ` Eli Zaretskii
2021-04-03 20:06                         ` Stefan Kangas
2021-04-03 22:28                           ` Alan Third
2021-04-04  9:21                             ` Stefan Kangas
2021-04-04 11:37                             ` Eli Zaretskii
2021-04-04 11:44                               ` Alan Third
2021-04-04 11:55                                 ` Eli Zaretskii
2021-04-04  6:55                           ` Eli Zaretskii
2021-04-04  9:21                             ` Stefan Kangas
2021-04-04 11:13                               ` Eli Zaretskii
2021-04-04 11:37                                 ` Alan Third
2021-04-04 11:48                                   ` Eli Zaretskii
2021-04-04 12:38                                     ` Eli Zaretskii
2021-04-04 13:15                                       ` Alan Third
2021-04-04 13:14                                     ` Alan Third
2021-04-04 13:22                                       ` Eli Zaretskii
2021-04-04 13:28                                         ` Alan Third
2021-04-04 13:36                                           ` Eli Zaretskii
2021-04-04 11:39                                 ` Stefan Kangas

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=CADwFkmku9WpSHr1qLCD5q2a02jPxQ35pzfdd3BzSxo6v4jhGSQ@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=47074@debbugs.gnu.org \
    --cc=alan@idiocy.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).