From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud Newsgroups: gmane.emacs.bugs Subject: bug#59802: 30.0.50; Checkbox button not rendered Date: Tue, 13 Dec 2022 10:21:47 +0100 Message-ID: <87fsdjd5g4.fsf@ledu-giraud.fr> References: <87v8mshit6.fsf@ledu-giraud.fr> <838rjoendw.fsf@gnu.org> <87r0xgh7c3.fsf@ledu-giraud.fr> <83zgc4crg6.fsf@gnu.org> <87ilisgxbi.fsf@ledu-giraud.fr> <83lenocoge.fsf@gnu.org> <87edtggol3.fsf@ledu-giraud.fr> <83359vd535.fsf@gnu.org> <87cz8s3gq7.fsf@ledu-giraud.fr> <83sfhozreh.fsf@gnu.org> <87ilik8zjs.fsf@gmx.net> <83v8mjweqm.fsf@gnu.org> <87h6y3447l.fsf@gmx.net> <83cz8rw5pq.fsf@gnu.org> <874ju2qe3a.fsf@gmx.net> <83k02yszqf.fsf@gnu.org> <87k02wd0hl.fsf@ledu-giraud.fr> <83lencr08t.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35067"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: stephen.berman@gmx.net, 59802@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 13 10:23:36 2022 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 1p51Vg-0008up-1c for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Dec 2022 10:23:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p51UG-0006cf-3B; Tue, 13 Dec 2022 04:22:08 -0500 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 1p51UB-0006bk-Lq for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 04:22:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p51UA-0003b4-U7 for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 04:22:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p51UA-0002Fb-Ce for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 04:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Dec 2022 09:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59802 X-GNU-PR-Package: emacs Original-Received: via spool by 59802-submit@debbugs.gnu.org id=B59802.16709233138642 (code B ref 59802); Tue, 13 Dec 2022 09:22:02 +0000 Original-Received: (at 59802) by debbugs.gnu.org; 13 Dec 2022 09:21:53 +0000 Original-Received: from localhost ([127.0.0.1]:59176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p51U1-0002FK-9e for submit@debbugs.gnu.org; Tue, 13 Dec 2022 04:21:53 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]:34823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p51Ty-0002FE-Tg for 59802@debbugs.gnu.org; Tue, 13 Dec 2022 04:21:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=PieF4FRo4NKR1ipp MT86KMX5pze2iqcGqX1/UamNO+w=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=Z6dKjGESGIAeeJjJTJ5I2nRhsI+4C1ufsfUmwN rb9JtVOkG8oRWYYqMLLST+AVkf/sP8VThUeBvBdCnybORoriXtndoEliv1E30BO1diTr7p OXMd3dDTF0CroUR9ixmpk8w1RpvUvUk5yV5EnLG8OUS5yqYYj8RmxX1BFD4LRC4ocbBh6o +/4zScrrkPMR8CboN8ylmx9Xve2D6h3cg+f7sSOJErEn/W+8BINo6/pkHBIcKynBbzAVxl Gpi4gToSg6SKdwoYfRr/3JUE5gWeQWxRnR7EdSVv95af8+H7dZ2ZN206Xo2w+hWIDpLUtH ZDlG32tXwM/tXMWYmnb1MVWg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 26c408f5 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 13 Dec 2022 10:21:49 +0100 (CET) In-Reply-To: <83lencr08t.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 12 Dec 2022 19:38:10 +0200") 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:250814 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: [...] > If this fixes the issue, I'm okay with installing this on the release > branch, but please make sure RSVG_UNIT_PERCENT was indeed introduced > in librsvg 2.46.0, and if it was introduced later, please add a > necessary LIBRSVG_CHECK_VERSION guard. Hi, Here is yet another version that is longer but I think is more correct. The previous patch fixes a percentage dimension as a percentage of "font_size". This works for our case here but might not always be correct. This new patch calculate the unknown percentage dimension with the other known dimension. It should work the same on our examples (maybe Stephen you could check that). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-SVG-scaling-bug-59802.patch >From e2d827b02b0ca9f383d44a1cc51fc2aacdcae2df Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Tue, 13 Dec 2022 10:10:03 +0100 Subject: [PATCH] Fix SVG scaling (bug#59802) Fix SVG scaling with librsvg>2.52 and SVG file with only one known dimension. * src/image.c (svg_load_image): Compute a percentage dimension with the other known dimension. --- src/image.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/image.c b/src/image.c index 2436f78ac3..a084143c41 100644 --- a/src/image.c +++ b/src/image.c @@ -11332,13 +11332,31 @@ svg_load_image (struct frame *f, struct image *img, char *contents, if (! (0 < viewbox_width && 0 < viewbox_height)) { - /* We haven't found a usable set of sizes, so try working out - the visible area. */ - rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL, - &zero_rect, &viewbox, - &out_logical_rect, NULL); - viewbox_width = viewbox.x + viewbox.width; - viewbox_height = viewbox.y + viewbox.height; + /* From the previous calculation, maybe one dimension is + zero and in percent unit. So calculate this dimension + with the other. */ + if (! (0 < viewbox_width) && (iwidth.unit == RSVG_UNIT_PERCENT) && + has_height && (0 < viewbox_height)) + { + viewbox_width = (viewbox_height * viewbox.width / viewbox.height) + * iwidth.length; + } + else if (! (0 < viewbox_height) && (iheight.unit == RSVG_UNIT_PERCENT) && + has_width && (0 < viewbox_width)) + { + viewbox_height = (viewbox_width * viewbox.height / viewbox.width) + * iheight.length; + } + else + { + /* We haven't found a usable set of sizes, so try working out + the visible area. */ + rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL, + &zero_rect, &viewbox, + &out_logical_rect, NULL); + viewbox_width = viewbox.x + viewbox.width; + viewbox_height = viewbox.y + viewbox.height; + } } } #else -- 2.38.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--