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.devel Subject: Re: Using more and/or better icons in Emacs Date: Sat, 10 Apr 2021 10:12:52 +0100 Message-ID: References: <2f0b4786-d569-27e6-fa8a-fb47bf08b166@yandex.ru> <0279fbc8-74c3-3766-2b26-b3eb933a501e@yandex.ru> 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="30452"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Dmitry Gutov To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 10 11:14:46 2021 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 1lV9hW-0007nu-2V for ged-emacs-devel@m.gmane-mx.org; Sat, 10 Apr 2021 11:14:46 +0200 Original-Received: from localhost ([::1]:44352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lV9hU-00067m-W1 for ged-emacs-devel@m.gmane-mx.org; Sat, 10 Apr 2021 05:14:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lV9gC-0005D9-7g for emacs-devel@gnu.org; Sat, 10 Apr 2021 05:13:25 -0400 Original-Received: from outbound.soverin.net ([2a01:4f8:fff0:2d:8::218]:39561) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lV9g0-0002Ty-6D for emacs-devel@gnu.org; Sat, 10 Apr 2021 05:13:23 -0400 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 4020B60191; Sat, 10 Apr 2021 09:12:59 +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=1618045978; bh=n4h9eKDspaZokWOOHfg5OE9RLPWZh8A9TspV1UENwuc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KVEMpVEBnWD6CYUkS7n9ea0AIVfGwPvbwZiihs+JWTnJR0/abIB+V5rvXDkitjKgt 26TFvJiJBrw38e/8hmPIYVOe98XLaaKHHrQZByPkFoTpw7cN4lyIRZmA0maDGhD4wA SbOuqvseHtTfi1jq6xDwEUZEZS1SWbMXkfA6HFNd3J7Zigfol1dke8ovwTryXtEzRZ hCOcI8Lg5DYRHMYHd3g/dIElMCVgNoi9l1N7f8skl5YaKunHvmRYcBg0N3L1FO+wDP wu45g9hLF10pXEugmCYeXW+05H3blE3KSWt6U/xLEShEm04yPmZt3Zl7H/SYfSqe3w z6HSMoiEbUK1w== Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 5D6FB202BBCD42; Sat, 10 Apr 2021 10:12:52 +0100 (BST) Mail-Followup-To: Alan Third , Stefan Kangas , Dmitry Gutov , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=2a01:4f8:fff0:2d:8::218; envelope-from=alan@idiocy.org; helo=outbound.soverin.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-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.23 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" Xref: news.gmane.io gmane.emacs.devel:267782 Archived-At: On Fri, Apr 09, 2021 at 08:43:56PM -0500, Stefan Kangas wrote: > Stefan Kangas writes: > > > Basing myself on that I have ended up with the following fragment: > > > > (let* ((scale (cadr (assoc :height (assoc 'default face-remapping-alist)))) > > (family (face-attribute 'default :family)) > > (height (* (aref (font-info family) 2) (if scale scale 1))) > > (ascent (* (aref (font-info family) 8) (if scale scale 1)))) > > (insert-image (create-image "material/action/ic_search_24px.svg" 'svg nil > > :height height > > :ascent 'center))) > > Hmm, I'm now testing simply using this, with width and height set to 1em > in the SVG file: > > (insert-image (create-image "material/action/ic_search_24px.svg" 'svg nil > :ascent 'center)) > > And it seems to do precisely the correct thing, as well as work with > `text-scale-adjust'. So perhaps that's the winner? Yes, sorry, I seem to have caused some confusion. I thought you were asking how to do the same thing without modifying the files. I don't know how to do the exact same thing, because as you say they don't scale with the text on the fly, but it's as near as I've been able to get. So modifying the files seems like the best solution to me. It works the best and doesn't require special code when inserting the image. -- Alan Third