aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorManuel Giraud2022-12-13 10:10:03 +0100
committerEli Zaretskii2022-12-16 17:47:37 +0200
commitdc78779c0cd1f057830458f341c280ddb6695409 (patch)
treee0d91eabc48cc8883e1d2223ab038ef500b769fe /src
parent10415d9651b0c85f9d6585cb789100c239c532b4 (diff)
downloademacs-dc78779c0cd1f057830458f341c280ddb6695409.tar.gz
emacs-dc78779c0cd1f057830458f341c280ddb6695409.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/image.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c
index 2436f78ac38..b881e43e951 100644
--- a/src/image.c
+++ b/src/image.c
@@ -11309,6 +11309,15 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
11309 img->face_font_size); 11309 img->face_font_size);
11310 viewbox_height = svg_css_length_to_pixels (iheight, dpi, 11310 viewbox_height = svg_css_length_to_pixels (iheight, dpi,
11311 img->face_font_size); 11311 img->face_font_size);
11312
11313 /* Here one dimension could be zero because in percent unit.
11314 So calculate this dimension with the other. */
11315 if (! (0 < viewbox_width) && (iwidth.unit == RSVG_UNIT_PERCENT))
11316 viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
11317 * iwidth.length;
11318 else if (! (0 < viewbox_height) && (iheight.unit == RSVG_UNIT_PERCENT))
11319 viewbox_height = (viewbox_width * viewbox.height / viewbox.width)
11320 * iheight.length;
11312 } 11321 }
11313 else if (has_width && has_viewbox) 11322 else if (has_width && has_viewbox)
11314 { 11323 {