[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
From: |
Eli Zaretskii |
Subject: |
emacs-29 dc78779c0c: Fix SVG scaling (bug#59802) |
Date: |
Fri, 16 Dec 2022 10:50:00 -0500 (EST) |
branch: emacs-29
commit dc78779c0cd1f057830458f341c280ddb6695409
Author: Manuel Giraud <manuel@ledu-giraud.fr>
Commit: Eli Zaretskii <eliz@gnu.org>
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 | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/image.c b/src/image.c
index 2436f78ac3..b881e43e95 100644
--- a/src/image.c
+++ b/src/image.c
@@ -11309,6 +11309,15 @@ svg_load_image (struct frame *f, struct image *img,
char *contents,
img->face_font_size);
viewbox_height = svg_css_length_to_pixels (iheight, dpi,
img->face_font_size);
+
+ /* Here one dimension could be zero because in percent unit.
+ So calculate this dimension with the other. */
+ if (! (0 < viewbox_width) && (iwidth.unit == RSVG_UNIT_PERCENT))
+ viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
+ * iwidth.length;
+ else if (! (0 < viewbox_height) && (iheight.unit ==
RSVG_UNIT_PERCENT))
+ viewbox_height = (viewbox_width * viewbox.height / viewbox.width)
+ * iheight.length;
}
else if (has_width && has_viewbox)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 dc78779c0c: Fix SVG scaling (bug#59802),
Eli Zaretskii <=