From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#47074: Replace XPM icons with Unicode codepoints in customize/widgets Date: Thu, 11 Mar 2021 23:49:54 +0000 Message-ID: References: <83a6r9mwgk.fsf@gnu.org> <8335x1mpdk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24166"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Kangas , 47074@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 12 00:56:51 2021 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 1lKVAe-00063O-S6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Mar 2021 00:56:49 +0100 Original-Received: from localhost ([::1]:47358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKVAd-0001ye-VA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Mar 2021 18:56:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKV55-00026V-2X for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 18:51:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lKV54-00064q-JL for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 18:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lKV54-000447-HI for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 18:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Mar 2021 23:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47074 X-GNU-PR-Package: emacs Original-Received: via spool by 47074-submit@debbugs.gnu.org id=B47074.161550660615557 (code B ref 47074); Thu, 11 Mar 2021 23:51:02 +0000 Original-Received: (at 47074) by debbugs.gnu.org; 11 Mar 2021 23:50:06 +0000 Original-Received: from localhost ([127.0.0.1]:55389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKV49-00042r-SS for submit@debbugs.gnu.org; Thu, 11 Mar 2021 18:50:06 -0500 Original-Received: from outbound.soverin.net ([116.202.65.218]:43281) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKV48-00042I-7w for 47074@debbugs.gnu.org; Thu, 11 Mar 2021 18:50:04 -0500 Original-Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 263E4601C9; Thu, 11 Mar 2021 23:49:58 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1615506597; bh=i4CYzJOve+N2zEwT9qCj2YDrOk2LeTAtdCGbsExqmY4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bbtvcJ4CWhVmzBFFOpg+GSPR6SzWUr9alWIYtEBi5uthowjOmbN05BzROPh817s8o ALe65uBARdY7YGsNOO9sz5hYb08cWuef3Q6SC7jSH456aNRBbiyRJmSRZlxIMr8dS/ T7aFNeEPq5VwB4KNbUN1VxymdVznODmJ3EmxzzyHMALADIRFsR8GGQcIkVO/4s1fzh xnACP5yaxo1YZhb/Vulph7mc/GHnb3SktvawUdeV069Uw+P7lCYgfFmwlOdexQfxsL kVgA8Hmzc4KAm5PIuVzMdsrWd4eobhyKosLWAEYmVofU9O3rvKoz5i/Ga9sPs+SkVQ ROuMU4m+5beww== Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id C9A77202AE7045; Thu, 11 Mar 2021 23:49:54 +0000 (GMT) Mail-Followup-To: Alan Third , Eli Zaretskii , Stefan Kangas , 47074@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <8335x1mpdk.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:202104 Archived-At: 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