From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Ponce Newsgroups: gmane.emacs.bugs Subject: bug#64908: 29.1; svg parse failure Date: Sat, 5 Aug 2023 14:32:07 +0200 Message-ID: References: <83o7jnwfd3.fsf@gnu.org> <835y5vw1ay.fsf@gnu.org> <83350yvd5f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2448"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 To: Alan Third , Eli Zaretskii , 64908@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 05 14:33:11 2023 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 1qSGT0-0000P4-LO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Aug 2023 14:33:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSGSu-0006Lp-V5; Sat, 05 Aug 2023 08:33:04 -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 1qSGSs-0006LS-N2 for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2023 08:33:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSGSs-0001bo-Ea for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2023 08:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSGSs-0004k5-A0 for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2023 08:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Aug 2023 12:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64908 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: unreproducible Original-Received: via spool by 64908-submit@debbugs.gnu.org id=B64908.169123873218168 (code B ref 64908); Sat, 05 Aug 2023 12:33:02 +0000 Original-Received: (at 64908) by debbugs.gnu.org; 5 Aug 2023 12:32:12 +0000 Original-Received: from localhost ([127.0.0.1]:56040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSGS4-0004iy-Eq for submit@debbugs.gnu.org; Sat, 05 Aug 2023 08:32:12 -0400 Original-Received: from smtp-22.smtpout.orange.fr ([80.12.242.22]:64205 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSGS2-0004io-Ho for 64908@debbugs.gnu.org; Sat, 05 Aug 2023 08:32:12 -0400 Original-Received: from [192.168.1.15] ([2.7.71.181]) by smtp.orange.fr with ESMTPA id SGRzqhKLyvliPSGRzqUYOU; Sat, 05 Aug 2023 14:32:09 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1691238729; bh=h3R9brXxfOrt1CUeYhIib/zArxqzO9geVO50iyJK4lU=; h=Date:Subject:To:References:From:In-Reply-To; b=PNdBKDTdf6tbKXqYjI4VGArM26AwbhWyOYRka1sfVZ7uNQiftp+9Wf7ccT6WLDuiJ gWQU1MoyFGrL31tBO6WeyNWAOSinODCj4JMi0kRwk99VvfBHkAYhp8qVBrUNTBQy8d OMWCUzSXCRA0sVN8PyCWMCApzZ2N7/tIhQjUPmKCPuoLF9PsfGCJ7TM3fp8cCr4iyn umz/ZHdDQfi+WS5hB0ykEFPx02iR6rnrGNHIwckQ5Xt1sA0i42C4o6ur9spHZdOMx1 IAY4z8INXT/XPkg0Macn/t173gZhdT2fACAN5KqObxElAVAJqglPx8s9pMm50vJTOt hEz+WupxY/BMQ== X-ME-Helo: [192.168.1.15] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sat, 05 Aug 2023 14:32:09 +0200 X-ME-IP: 2.7.71.181 Content-Language: fr, en-US In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266776 Archived-At: On 05/08/2023 11:58, Alan Third wrote: > Hi David, I did a bit of thinking about what a percentage in the width > or height attributes actually means and how librsvg handles it. > > I think we should always ignore it. > > A percentage is intended as a percentage of the enclosing box. this > means if we set an image width of 100 pixels in Emacs, and the width > in the SVG is 50%, the image should be 50 pixels wide. > > However we requested a width of 100 pixels, and Emacs will give us > that no matter what, even scaling it back up. > > Additionally, librsvg will scale the drawn image to a width of 50% > anyway. > > What this means is if we set the image width to 100 pixels, librsvg > will scale its drawing down by 50% and it should come out the correct > size within the 100 pixel wide image. > > I hope that made sense, it took me a bit of thinking about it before I > came to this conclusion. It was really the fact that librsvg scales > its drawing anyway that made me decide there's no point in us also > scaling it. > > I've attached a patch, can you give it a go and let me know how it > works. > > Or if you disagree with my analysis above, let me know, because I'm > not 100% sure of it. Hi Alan, I did test your V2 patch, and it seems to work well. I tend to agree with your reasoning, even if I am not enough a librsvg expert to fully understand all the details. One case however is not working, when the svg image just specify percentage for width and height without a viewbox, like this: '(image :type svg :data " " :scale 1) I can display a such image in firefox, gwenview, or inkscape, but not in Emacs. I guess it works in applications that provide a default viewbox when not defined. And it is failing in Emacs because no default viewbox is provided. What could be questionable is if it makes sense to fail when image also specifies :width and :height, like this: '(image :type svg :data " " :scale 1 :width 22 :height 22) I wonder if it could make sense to provide a default viewbox having image :width and :height? Not sure it will be useful, though. Thanks