From: Manuel Giraud <manuel@ledu-giraud.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stephen Berman <stephen.berman@gmx.net>, 59802@debbugs.gnu.org
Subject: bug#59802: 30.0.50; Checkbox button not rendered
Date: Mon, 12 Dec 2022 13:33:46 +0100 [thread overview]
Message-ID: <877cywer85.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <83k02yszqf.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 11 Dec 2022 17:54:00 +0200")
[-- Attachment #1: Type: text/plain, Size: 499 bytes --]
Hi Eli and Stephen,
I tried to understand the different librsvg APIs (which is quite a mess)
and AFAIU, rsvg_handle_get_geometry_for_layer use a viewport as input to
render the SVG. See, here:
https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/method.Handle.get_geometry_for_layer.html
So in the case we have already read a viewbox, I'm using it as the
viewport rectangle. I don't know if it is the best way but at least it
works for me (i.e the image does not disappear below the baseline)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-SVG-scaling-for-certain-files-with-librsvg-2.52-.patch --]
[-- Type: text/x-patch, Size: 1676 bytes --]
From 3531a0e8515bc7499fa1e1f123b46841c7f2e9fc Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Mon, 12 Dec 2022 11:56:25 +0100
Subject: [PATCH] Fix SVG scaling for certain files with librsvg > 2.52
(bug#59802)
* src/image.c (svg_load_image): Initialize viewport before calling
rsvg_handle_get_geometry_for_layer.
---
src/image.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/image.c b/src/image.c
index 2436f78ac3..7db6c9d2fc 100644
--- a/src/image.c
+++ b/src/image.c
@@ -11290,7 +11290,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
}
else
{
- RsvgRectangle zero_rect, viewbox, out_logical_rect;
+ RsvgRectangle viewport, viewbox, out_logical_rect;
/* Try the intrinsic dimensions first. */
gboolean has_width, has_height;
@@ -11332,10 +11332,19 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
if (! (0 < viewbox_width && 0 < viewbox_height))
{
+ /* Computed viewbox sizes are not correct but we may have
+ read a correct viewbox so use it as the viewport. */
+ if (has_viewbox) {
+ viewport.x = viewbox.x;
+ viewport.y = viewbox.y;
+ viewport.width = viewbox.width;
+ viewport.height = 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,
+ &viewport, &viewbox,
&out_logical_rect, NULL);
viewbox_width = viewbox.x + viewbox.width;
viewbox_height = viewbox.y + viewbox.height;
--
2.38.1
[-- Attachment #3: Type: text/plain, Size: 18 bytes --]
--
Manuel Giraud
next prev parent reply other threads:[~2022-12-12 12:33 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cywer85.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.