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.bugs Subject: bug#40845: SVG rendering issues Date: Sat, 25 Apr 2020 08:19:01 -0400 Message-ID: <72ebf5eb-6b00-ebb4-dab3-a047e35ae1ae@gmail.com> 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="7692"; 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 To: 40845@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 25 14:20:18 2020 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 1jSJn7-0001um-J5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Apr 2020 14:20:17 +0200 Original-Received: from localhost ([::1]:36036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSJn6-00057T-Fe for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Apr 2020 08:20:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39248) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSJmt-00057M-2Y for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 08:20:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSJms-0007hu-Kx for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 08:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jSJms-0007g3-7z for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 08:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jSJms-0006u3-1w for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 08:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Apr 2020 12:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40845 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.158781714726465 (code B ref -1); Sat, 25 Apr 2020 12:20:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Apr 2020 12:19:07 +0000 Original-Received: from localhost ([127.0.0.1]:58966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSJlz-0006sn-2F for submit@debbugs.gnu.org; Sat, 25 Apr 2020 08:19:07 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSJlx-0006se-4H for submit@debbugs.gnu.org; Sat, 25 Apr 2020 08:19:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39044) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSJlw-00054f-Jc for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 08:19:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSJlw-0002pu-0j for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 08:19:04 -0400 Original-Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:43884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jSJlv-0002ji-JO for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 08:19:03 -0400 Original-Received: by mail-qk1-x730.google.com with SMTP id 20so13062661qkl.10 for ; Sat, 25 Apr 2020 05:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:autocrypt:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=EXyY7M8OIwPJshCO1sNAUYtcBQ1bW0LzSRehAzdcQ8M=; b=icDLS0zXfLfRrTWl0ziruretlWU26eaiAAb1xZQwt1/7LS1gRupfchILvM9bdN/0tq v8ViU8h0ZfSwB8dPVeobGEvOHKA/VjV0uzmCgMLHO5b2Wk5ACSvAKe07VjQVgg8c5UPG BCxjz5zzhuMVlzBFfF4kMKnqUbVKiqyhkLRuZyUHzDcl6JKpjbQzkuxx+uoTEkxWOiYr Ij3k9o013EndCxReGDdY6nzp1TAuAO3zU5kA8t9i4JTajjO4BLiMrcU3ge7FgAxvO/hp KAI0k95lGlk07Qgr0MJhUBK8wGlayjr78IN0+r2K3s1wtQ3Ryuhl6LSR/5YqKIjW5fEe TooA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:autocrypt:subject:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=EXyY7M8OIwPJshCO1sNAUYtcBQ1bW0LzSRehAzdcQ8M=; b=k+v0/l27LlDDvpdnZMsdgEwrpFTVW+2rw3W/G0TEqDhYlnwWZ4wpPyyiv2lJZOZHag j/mVqzInUyN57P53ukn92Mg6/hK+//HfQBVDrhPNrwEjdNK2qKxnzZwXcOaml31Eghaz MsvPsRurpu25UgKHfUM+vz6jiTKNc1FE90y3uSt38En6G7xSdil0oxgxe8RyL//IbM4D U8EmN/PVuH49p/FPXFhwzTQpeg6m3IItAkb1RClKrAtNyECqqDs+/YvOibsERtHk40VD kVcY+VsqZ66fRl5bPcMj46Gmv4mt2jiV7sNlqiBOlkFMdiO6SQGT8jh/TUolnUWn40mc UcyQ== X-Gm-Message-State: AGi0Pua/fy95Xgs2anZ+r60RLM6rbBE63PoN/rI797I0n3B9RBOOzsEN P9h4LXVptHovtrY46ckGH7RAM2Ar X-Google-Smtp-Source: APiQypJ4UaLssyz159ZIx6HRLiWHsjvEQ/DcXqCngfloj2ijI+Deib0BlXwD5aHb+Sud2/Jp+RNZFQ== X-Received: by 2002:a05:620a:b10:: with SMTP id t16mr13676271qkg.59.1587817142347; Sat, 25 Apr 2020 05:19:02 -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 s14sm6032134qts.70.2020.04.25.05.19.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Apr 2020 05:19:01 -0700 (PDT) Autocrypt: addr=clement.pitclaudel@live.com; prefer-encrypt=mutual; keydata= xsFNBFStGiEBEAC8eHa+DdcrVtDSwYoIgoUtMfRAan4bdLxZuNIASy6iFytCHNsKqfPkq8zD YV2+uMtbdcnjapE038nidEMItNhO04JdZ+PJ6jvJo1gW+XI4fM8uzkGZauwR+d3hEq6goFSp rIlSlaVf2g5q4OKxI754yqwz00++EZhZQMntzoKQVV9stJ5eQ+gxTT1ANr7wQKbjn/8PM/Cg hBZvYLhh+WsS0Ko5qZuWdsvUBLpprmCWkP4FpZ234/tWpdVID65nlHpu25+6ajIcxfCIK+dN 2br0wN1szTeQFG19cfr3jXEvwHmLQbQqCg4UH+2b7JpMGR2/KWjqRWfWVvZMPVeJdOsZHx53 k6HIbEhvFBHbmqCI6FAZQjkgzGGkrSD92+jeMYiCTxRKqq2hFZ6xqQ6pJdXD1TXcIYPEs7rA MwcNMj8g4e6vuI+2CjHyQQkyMPAEi8guNPnyfBb648f1lxj7JiJu/ehRghIP5u/kLOsHNCKG QgCT04sawBZYHqEVYni8oHlGJcdWGT5/UI4B+wn70eXvYSScZEaB+S2s/bD0cdlSpHY5Od3l tpRZTva+ydswlrz4fxbYF45s6rFpqVwBMfNv3gqhBFXbuiEEctcTSGqhHxxT4R+24Yn+ZSBa EfUbrKnVTUmV20k+57rghiVw2wpj8v7sn3QXt96HJ9ImY4JvuwARAQABzTNDbMOpbWVudCBQ aXQtLUNsYXVkZWwgPGNsZW1lbnQucGl0Y2xhdWRlbEBsaXZlLmNvbT7CwXsEEwECACUCGyMG CwkIBwMC Content-Language: en-GB Received-SPF: pass client-ip=2607:f8b0:4864:20::730; envelope-from=cpitclaudel@gmail.com; helo=mail-qk1-x730.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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 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:178985 Archived-At: Hi all, As discussed on the mailing list, a number of issues currently exist with our SVG rendering implementation. I have tried to summarize the ones I'm aware of in the following example. (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")) (add-text-properties (point-min) (point-max) '(face (:foreground "orange" :background "purple") mouse-face '(:foreground "purple" :background "orange")))) (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 (e.g. when mouse-face applies, which is important for buttons) - For 4, the :foreground property should be respected For 5, it's a bit trickier. One option would be to accept a float-valued :height specification and treat that as a multiple of the current font size. A partial workaround for 2 is to add an explicit :background, but it doesn't help with face changes, such as applying a mouse-face. For 1 and 5 it can be enough to set the size in the SVG and add hooks, but that only works easily for SVGs created within emacs. For 3 and 4, I don't know of a workaround except modifying the SVG. Cheers, Clément.