From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jimmy Yuen Ho Wong Newsgroups: gmane.emacs.devel Subject: Mechanism to scale SVG images when default face height changes? Date: Mon, 18 Sep 2023 18:42:33 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f6b6240605a5ac98" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17825"; mail-complaints-to="usenet@ciao.gmane.io" To: Emacs-Devel devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 18 19:44:16 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qiIIB-0004YF-Kq for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Sep 2023 19:44:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiIHD-0005zv-Ge; Mon, 18 Sep 2023 13:43:15 -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 1qiIHC-0005y1-B8 for emacs-devel@gnu.org; Mon, 18 Sep 2023 13:43:14 -0400 Original-Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiIHA-0007Iq-7D for emacs-devel@gnu.org; Mon, 18 Sep 2023 13:43:14 -0400 Original-Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-26934bc3059so4223420a91.1 for ; Mon, 18 Sep 2023 10:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695058990; x=1695663790; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=IiqkQINnUTMqzHr0Ds7q3kq9XzEfSM/XQMjul6L9F4w=; b=InxJdEU0HEjMKY1KHOZ0ziq07P3XADIsSExkCYcfBO7KMGjzHghvbyRQaSt9LffpG/ UDdvcaUCnR6960N5xoXqKOd5aaHTB5kR4gQF8o9OgNKd5a3W0SGb+zPke3Kz31NRCKz3 Y75/O1uPTe9b42keye6h87vt99k5H9x9KrRYPbPf4tnr4+fruhtMb2F76DDrVlpjQDaT m6zg+IeHClA6Cdsx3vGYTL+oalvE1LdAEQCHkYSViKd2vjiQeIeLSYqWmvKtC9rBF9aD mSubVjrBkHSrXFWZWhjKnrBgy+Q2L09HLmv13+NWb3t6TGW3jp5uvMqudEXXJfXnPhup Hhaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695058990; x=1695663790; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IiqkQINnUTMqzHr0Ds7q3kq9XzEfSM/XQMjul6L9F4w=; b=l2oegB+o6t3RsUXcuX/GtUyXWPuLUnO5apCXXa7URt7u4AA/sforezVAG1Qes2ZzFN cyTBFNJkToPhAPGuiICuxOSe3ZlIO7FKywBgqD2YhWHvkvO1uC0GyDPsUXAEBk5df+W1 vi9snA8MIfmJSrh6p+VyRvpT5Co/ibdhf6JBWW0J6YUK/n+IU/EBcobmiKxfQYiAUk4+ 0x1IXc2GiTZZhmF3oYaZ/s4sEzWUQgl6/6pa5KNt8ouduJBfRyrkEuQ0wQ5/lMSgzdHS HYo4l0B6XbquzeLfgp17+CmnkzAkWD1j0yxxh7ctDbvDY95POGLgqzlvLWKFrKz7d9QZ Rcaw== X-Gm-Message-State: AOJu0YwLVObgXgb4xLMigmjaG72svXsy+mqjYtqIfzDbtd1ijzV/0Mwl dq9+7eM7XzZyToLnpVQsyb67k97j9WK5N5BtFGumZa8vzDaVgw== X-Google-Smtp-Source: AGHT+IEtCS5bMJ3KgdO6EfJYt5hm2dkl6Hzx2kzOwKW13QQisOsVP2SOGu/vIDfQ+YaxwUSs3vScpJJ05i189xHcMAc= X-Received: by 2002:a17:90a:e002:b0:276:5512:13ab with SMTP id u2-20020a17090ae00200b00276551213abmr366830pjy.10.1695058989855; Mon, 18 Sep 2023 10:43:09 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=wyuenho@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310712 Archived-At: --000000000000f6b6240605a5ac98 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi everyone, all-the-icons maintainer here. Recently I've converted all-the-icons from using icon-fonts to SVGs. A few early testers of this branch have reported that when they resize the default face, either by text-scale-mode, loading a different theme or setting the default face size attributes manually, the SVG icons inserted into the buffers do not scale accordingly. In the SVG branch in all-the-icons, all the icons are inserted with a `:width` and `:height` properties set on the image, and the face is applied to the propertized string. i.e. ```elisp ELISP> (all-the-icons-icon-for-file "test.js") #("=EF=BF=BC" 0 1 (face all-the-icons-lpurple font-lock-face all-the-icons-lpurple fontified t display (image :type svg :data " " :scale 1 :transform-smoothing t :width 14 :height 14 :ascent center :margin 1) front-sticky nil rear-nonsticky t)) ``` As far as I understand, simply adjusting the scale factor of the image will suffice. The problem is, since Emacs doesn't do it by itself, I don't really know how to do it in Elisp and be performant. Are there any hooks or internal undocumented functions that I can use to scale all the images in all of the frames when the default face size changes? Thanks, Jimmy Yuen Ho Wong --000000000000f6b6240605a5ac98 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi everyone,

all-the-icons m= aintainer here. Recently I've converted all-the-icons from using icon-f= onts to SVGs. A few early testers of this branch have reported that when th= ey resize the default face, either by text-scale-mode, loading a different = theme or setting the default face size attributes manually, the SVG icons i= nserted into the buffers do not scale accordingly.

In the SVG branch in all-the-icons, all the icons are inserted with a `:wi= dth` and `:height` properties set on the image, and the face is applied to = the propertized string. i.e.

```elisp
ELISP>= (all-the-icons-icon-for-file "test.js")
#("=EF=BF=BC&q= uot; 0 1
=C2=A0 (face all-the-icons-lpurple font-lock-face all-the-icons= -lpurple fontified t display
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (image :type sv= g :data "<svg viewBox=3D\"0 0 512 512\" width=3D\"51= 2\" height=3D\"512\"> <path d=3D\"...snip...\&quo= t;></path></svg>" :scale 1 :transform-smoothing t :widt= h 14 :height 14 :ascent center :margin 1)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 fr= ont-sticky nil rear-nonsticky t))
```

As f= ar as I understand, simply adjusting the scale factor of the image will suf= fice. The problem is, since Emacs doesn't do it by itself, I don't = really know how to do it in Elisp and be performant. Are there any hooks or= internal undocumented functions that I can use to scale all the images in = all of the frames when the default face size changes?

<= div>Thanks,

Jimmy Yuen Ho Wong
--000000000000f6b6240605a5ac98--