From: Manuel Giraud <manuel@ledu-giraud.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: stephen.berman@gmx.net, 59802@debbugs.gnu.org
Subject: bug#59802: 30.0.50; Checkbox button not rendered
Date: Tue, 13 Dec 2022 10:21:47 +0100 [thread overview]
Message-ID: <87fsdjd5g4.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <83lencr08t.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 12 Dec 2022 19:38:10 +0200")
[-- Attachment #1: Type: text/plain, Size: 687 bytes --]
Eli Zaretskii <eliz@gnu.org> 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).
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-SVG-scaling-bug-59802.patch --]
[-- Type: text/x-patch, Size: 2056 bytes --]
From e2d827b02b0ca9f383d44a1cc51fc2aacdcae2df Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
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
[-- Attachment #3: Type: text/plain, Size: 18 bytes --]
--
Manuel Giraud
next prev parent reply other threads:[~2022-12-13 9:21 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-03 10:40 bug#59802: 30.0.50; Checkbox button not rendered Manuel Giraud
2022-12-03 11:29 ` Eli Zaretskii
2022-12-03 14:47 ` Manuel Giraud
2022-12-03 17:44 ` Eli Zaretskii
2022-12-03 18:16 ` Manuel Giraud
2022-12-03 18:22 ` Eli Zaretskii
2022-12-03 18:24 ` Manuel Giraud
2022-12-03 18:49 ` Eli Zaretskii
2022-12-03 21:32 ` Manuel Giraud
2022-12-04 7:02 ` Eli Zaretskii
2022-12-09 12:26 ` Manuel Giraud
2022-12-09 12:35 ` Eli Zaretskii
2022-12-09 13:41 ` Stephen Berman
2022-12-09 14:07 ` Manuel Giraud
2022-12-09 14:14 ` Stephen Berman
2022-12-10 13:49 ` Eli Zaretskii
2022-12-10 16:24 ` Stephen Berman
2022-12-10 17:04 ` Eli Zaretskii
2022-12-10 17:57 ` Manuel Giraud
2022-12-10 18:38 ` Eli Zaretskii
2022-12-11 13:12 ` Stephen Berman
2022-12-11 14:47 ` Eli Zaretskii
2022-12-11 15:54 ` Eli Zaretskii
2022-12-11 22:40 ` Stephen Berman
2022-12-12 17:42 ` Eli Zaretskii
2022-12-12 23:38 ` Stephen Berman
2022-12-12 12:33 ` Manuel Giraud
2022-12-12 16:56 ` Manuel Giraud
2022-12-12 17:25 ` Stephen Berman
2022-12-12 17:38 ` Eli Zaretskii
2022-12-13 9:21 ` Manuel Giraud [this message]
2022-12-13 10:16 ` Stephen Berman
2022-12-13 12:49 ` Eli Zaretskii
2022-12-13 16:16 ` Manuel Giraud
2022-12-13 16:40 ` Eli Zaretskii
2022-12-13 17:15 ` Manuel Giraud
2022-12-13 17:36 ` Eli Zaretskii
2022-12-16 8:27 ` Manuel Giraud
2022-12-16 15:51 ` Eli Zaretskii
2022-12-16 16:09 ` Manuel Giraud
2022-12-09 13:57 ` Manuel Giraud
2022-12-10 13:47 ` Eli Zaretskii
2022-12-10 14:26 ` Manuel Giraud
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsdjd5g4.fsf@ledu-giraud.fr \
--to=manuel@ledu-giraud.fr \
--cc=59802@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).