From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: High-res Customize icons Date: Fri, 24 Apr 2020 22:55:13 -0400 Message-ID: References: <83k126ck8u.fsf@gnu.org> <838simc8zf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="89953"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: ndame@protonmail.com, stefan@marxist.se, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 25 04:55:59 2020 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 1jSAz0-000NHv-VV for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Apr 2020 04:55:58 +0200 Original-Received: from localhost ([::1]:56970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSAz0-0004uk-06 for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Apr 2020 22:55:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33654) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSAyM-00047j-5O for emacs-devel@gnu.org; Fri, 24 Apr 2020 22:55:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSAyL-0003ip-HL for emacs-devel@gnu.org; Fri, 24 Apr 2020 22:55:17 -0400 Original-Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:38118) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jSAyL-0003Xe-3E; Fri, 24 Apr 2020 22:55:17 -0400 Original-Received: by mail-qk1-x72a.google.com with SMTP id o19so12405355qkk.5; Fri, 24 Apr 2020 19:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2vKKxG3p8rLKFjxtB4atzCC480UGuZyb0XnzYw7HWiU=; b=gatZ9N3p3llzxfw/KvR7t4qYv4hV0gS1lUkVpdqsoDJ4+kxTUE/MNSuI39NyuBF1n0 8S6jAGHNG9uRGHn/T1FxdrJ9qBNIVNo1VZnn632EzyF8d6VtEVCiKZ3wisSiOe3HKplT tslzoIQASFNwEfTTGIyrmXnkxSGPalHJX7ywi575/4WPJl69g3m3jgPZyCK30gFZQCrp 9rk9aSiaGwLwiBZLYV9wYT4SMw1aNFfvxTdlYMpIcDeU54SDuB2x0FDCkoxY97p5G26R zLP0DzkjcHcUWzDCUW0rhVvu47hL2iPM3ChzrIU99djTMGlU8lQU9CQhIVoutZ/ruz9h mhtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2vKKxG3p8rLKFjxtB4atzCC480UGuZyb0XnzYw7HWiU=; b=oYOpEP7h2KuUEKXco0lBUxfRbzHH6L/tJG/5KVLECFXJDdM3L45Ke2sdvAPwQXOj55 tRhDCouN6LtszE/BLM3F73Cg5JBPpDrVZmY2ZRpV1tKA3KhmgxRkDxvaU/mfBqfAgmYM kFA2kEATDDnciiNCHAIbX/iVFrDxf3MTsRmrG6SFT+J7/gYGm/ztbhw8As0T2tG6V31h /+dkuAzMMv1baVEoESILSXIBGytvojdT3GQLqDp1sOhA+eNfkDhJpLYY4QpjUvK3cAaU r4G6vOU/kOuKNNXE9hdDP6OTWAV3HEbLfBL3z8IzdbhT0QLi3kp3N82GDgxGcF18aP7z PBcA== X-Gm-Message-State: AGi0PuaUE9FRJmgF5M+bGHUZ9p605wYILcikDbjIiOEeMad7lX/ZiX8I R/Or/NnmoWCQb+AIvlvQ9H0= X-Google-Smtp-Source: APiQypLTt51w3tCb+ytx1VUrS74xaOjq9qNX9L+yMraeX0V+T2j82rzM043tI3NyzVC7XuWXYpr0kg== X-Received: by 2002:a37:6751:: with SMTP id b78mr12091906qkc.66.1587783315484; Fri, 24 Apr 2020 19:55:15 -0700 (PDT) Original-Received: from ?IPv6:2601:184:4180:66e7:54d6:bfeb:aa49:9d3b? ([2601:184:4180:66e7:54d6:bfeb:aa49:9d3b]) by smtp.googlemail.com with ESMTPSA id o201sm5084471qke.31.2020.04.24.19.55.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Apr 2020 19:55:14 -0700 (PDT) In-Reply-To: <838simc8zf.fsf@gnu.org> Content-Language: en-GB Received-SPF: pass client-ip=2607:f8b0:4864:20::72a; envelope-from=cpitclaudel@gmail.com; helo=mail-qk1-x72a.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::72a 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:247733 Archived-At: On 23/04/2020 15.12, Eli Zaretskii wrote: >> Cc: emacs-devel@gnu.org, ndame@protonmail.com >> From: Clément Pit-Claudel >> Date: Thu, 23 Apr 2020 11:49:04 -0400 >> >> I agree, but we need to solve two concrete issues with SVG scalable images before they are usable: >> >> * Automatic scaling (changing the font size automatically resizes icon fonts, but not images) >> * Adjusting the background color (currently the SVG renderer uses the background color of the default face, while icon fonts use the right background color) > > So let's fix them, that doesn't sound too difficult. That's great to hear; it's often hard to know what's easy and what isn't ^^ Are these bugs tracked somewhere? If not, here's a simple repro, which at least should provide a consistent recipe to start fixing the problem(s): (with-current-buffer (get-buffer-create "*svg bugs*") (erase-buffer) (require 'face-remap) (setq text-scale-mode-amount 10) (text-scale-mode) (let ((svg (svg-create 16 16))) (svg-ellipse svg 8 8 4 4) (insert "Text: ") (print (svg-image svg :ascent 100)) (insert-image (svg-image svg :ascent 100)) (insert-image (svg-image svg :scale 5.0 :ascent 'center :foreground "red" :background "darkgreen")) (put-text-property (point-min) (point-max) 'face '(:foreground "orange" :background "purple"))) (pop-to-buffer (current-buffer))) The issues: 1. Manually scaling an image, as is done for the second image, doesn't re-render the svg: is scales the bitmap-rendered version of it, causing blurriness 2. The SVG images don't inherit the background of the current face; instead, they inherit the background of the default face. 3. The SVG images don't inherit the foreground of the current face; instead, they use a black foreground. 4. The :foreground keyword has no effect on svg images. 5. The images are not scaled with the text: changing text-scale-mode-amount doesn't change the size of the images. For 1, 2, 3, and 4, the expected behavior is easy to define: - For 1, the image should be scaled before being rasterized. - For 2 and 3, the image should inherit the characteristics of the current face, and be re-rendered if that face changes. - For 3, the :foreground property should apply For 5, it's a bit trickier. One option would be to accept a float-valued :height specification and understand this as a multiple of the current font size? The workaround for 2 is not too bad (add an explicit :background); for the other issues, it's quite bit trickier (for 1 it can be enough to set the size in the SVG, but that only works easily for SVGs created within emacs). Sorry if this is redundant or if I missed something obvious, Clément.