unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Kangas <stefan@marxist.se>, 47074@debbugs.gnu.org
Subject: bug#47074: Replace XPM icons with Unicode codepoints in customize/widgets
Date: Thu, 11 Mar 2021 23:49:54 +0000	[thread overview]
Message-ID: <YEqsopHeUKuLLYyd@breton.holly.idiocy.org> (raw)
In-Reply-To: <8335x1mpdk.fsf@gnu.org>

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.

It might mean rewriting the code I recently rewrote to extract the
foreground and background colours to just reference the face id, but
that will probably result in even less good image caching than we have
at the moment.

In fact, it's possible to build an SVG within Emacs that contains the
correct font details that will display at the correct size.

Something like this:

(require 'svg)
(let* ((scale (cadr (assoc :height (assoc 'default face-remapping-alist))))
       (height (* (/ (face-attribute 'default :height) 10) (if scale scale 1)))
       (family (face-attribute 'default :family))
       (img (svg-create height height
			:font-size height
			:font-family family)))
  (svg-circle img "0.5em" "0.5em" "0.5em")
  (insert "XX")
  (insert-image (svg-image img :ascent 'center))
  (insert "XX"))

Alas it doesn't resize the image as you scale with C-x C-+.

Perhaps there is some way to mark certain SVGs as part of the UI and
regenerate them?

Yet another alternative is to define a different text property (or
whatever) that only draws SVGs, but on the fly so there's no caching
and we can put them anywhere in the frame. But that might not be a
good idea.
-- 
Alan Third





  reply	other threads:[~2021-03-11 23:49 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 [this message]
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
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=YEqsopHeUKuLLYyd@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=47074@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=stefan@marxist.se \
    /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).