unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44206: 28.0.50; SVG image fail to show
@ 2020-10-25  3:25 styang
  2020-10-25 16:01 ` Alan Third
  0 siblings, 1 reply; 6+ messages in thread
From: styang @ 2020-10-25  3:25 UTC (permalink / raw)
  To: 44206

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

Some SVG images fail to show due to regression caused by:
b42481e22e * | Fix SVG image dimension calculations (bug#44065)

Please find the offending SVG file in attachment (in fact, all custom avatars in telega.el are not showing). When opened via `emacs -Q 222.svg`, it shows an empty box, with the following message in *Messages*

Invalid image size (see ‘max-image-size’)
Error parsing SVG image ‘(image :type svg :file /tmp/222.svg :scale 1 :max-width 1229 :max-height 585 :format nil)’


Affected librsvg version: 2:2.50.1-1 in Archlinux, and 2.44.10-2.1 in Debian.


[-- Attachment #2: SVG --]
[-- Type: image/svg+xml, Size: 10098 bytes --]

<?xml version="1.0" encoding="UTF-8"?><svg width="20" height="18.900000000000002" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <clipPath id="clip"> <circle cx="10" cy="9.450000000000001" r="8.4"></circle></clipPath></defs> <image xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAICAgICAQICAgIDAgIDAwYEAwMDAwcFBQQGCAcJCAgHCAgJCg0LCQoMCggICw8LDA0ODg8OCQsQERAOEQ0ODg7/2wBDAQIDAwMDAwcEBAcOCQgJDg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg7/wAARCACgAKADASIAAhEBAxEB/8QAHQAAAQQDAQEAAAAAAAAAAAAABAIDBwgBBQYACf/EADUQAAIBAwMDAwMEAAUFAQEAAAECAwQFEQAGIQcSMRMiQQhRYRQycYEVI0KRoQkkQ1KxwfH/xAAaAQADAQEBAQAAAAAAAAAAAAAAAQIDBAUG/8QAKREAAgICAgIB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H2zqjIKLZ5zzryspB5wc+NBtISoxnOdKRgSAeD8jQAcGz+NeLcDnOh2YgHntI1gOSEIzgg6YBKkhgR4zo1fSPaT/AM/GgVb2jgH+dYY888fjQBsWeBQzGVVH5OhHngB9sobQhKlD8DHOdCMqqx7W8aQGwkaJgQWJOOMa+PvXTbe9OoFHeNxLXH9DDeXpI7dcC5lmBf8A8bKCgKgchsEjxxr6yV1aaOz1cyqkkscDtGrt2qzAHtBP2JwNUK3DHDNZFg9m3ZZa56uSCBwY45GYs5UHgD7fbOuXM6o1grKvdJ+idDc75Pdt2tVWulhQKkVLIsUjscd3awHAwPIwcH7nj6gdHbbZrfbq2ms9qp7VaqLtho4oDkdvkMSecn5ySfydVx2/ZlqIGSlH6mmhQZlduM45P8n+zq4WwbALNsKCNyWkmAkdj58cayx3KZckktEgKRnTqv2nxnQqDtU4HcfsNOjuGdd4ltBizkjnyBpYnkXHb2gAfbQQJ+2nVPGCPjQAQ1XOc+8/wNY9Z2U+9ufzobI9TOeNOKeBgeNJoGf/2Q==" clip-path="url(#clip)" height="16.8" width="16.8" y="1.05" x="1.5999999999999996"></image></svg>

[-- Attachment #3: Type: text/plain, Size: 178 bytes --]




-- 
Sheng Yang(杨圣), PhD student
Computer Science Department
University of Maryland, College Park
E-mail: styang@fastmail.com
E-mail(old): yangsheng6810@gmail.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44206: 28.0.50; SVG image fail to show
  2020-10-25  3:25 bug#44206: 28.0.50; SVG image fail to show styang
@ 2020-10-25 16:01 ` Alan Third
  2020-10-25 17:17   ` Sheng Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Third @ 2020-10-25 16:01 UTC (permalink / raw)
  To: styang; +Cc: 44206

[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]

On Sat, Oct 24, 2020 at 10:25:03PM -0500, styang@fastmail.com wrote:
> Some SVG images fail to show due to regression caused by:
> b42481e22e * | Fix SVG image dimension calculations (bug#44065)
> 
> Please find the offending SVG file in attachment (in fact, all
> custom avatars in telega.el are not showing).

Thanks. It appears there are more ways to define an SVG size than I've
had hot dinners.

librsvg is really not helping here. The documentation makes it pretty
clear that they don't want us to be querying the SVG dimensions and
would prefer us to just give them the dimensions we want and/or to use
Cairo.

That doesn't really work for us because we don't know up-front what
dimensions are usable for the image. It would be a different matter if
we were using the SVGs as GUI components like buttons or something.

Anyway, I've thrown in another attempt at calculating the image size,
and it works for this and also for the previous images. This one is
more complex because it's trying to convert CSS sizes to pixel sizes
and I don't think we can be entirely sure of some of them (like ex
height? Maybe we can query that, but then we have to know font and
font size).

I have no doubt that there are many more SVG files out there that
won't display properly even with this patch.

> Affected librsvg version: 2:2.50.1-1 in Archlinux, and 2.44.10-2.1 in Debian.

I'm concerned that librsvg 2.44 is affected as it should be using the
same code path as before the commit in question.
-- 
Alan Third

[-- Attachment #2: 0001-Calculate-SVG-image-sizes-more-accurately-bug-44206.patch --]
[-- Type: text/plain, Size: 4703 bytes --]

From a178c8b58e37550a897062f1edfe1f674bf7d210 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sun, 25 Oct 2020 15:45:07 +0000
Subject: [PATCH] Calculate SVG image sizes more accurately (bug#44206)

* src/image.c (svg_css_length_to_pixels): New function.
(svg_load_image): Try more methods to work out the image size.
---
 src/image.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 93 insertions(+), 5 deletions(-)

diff --git a/src/image.c b/src/image.c
index 5f6d9f4c44..2f9c21cbcc 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9724,6 +9724,44 @@ svg_load (struct frame *f, struct image *img)
   return success_p;
 }
 
+static double
+svg_css_length_to_pixels (RsvgLength length)
+{
+  /* FIXME: 96 appears to be a pretty standard DPI but we should
+     probably use the real DPI if we can get it.  */
+  double dpi = 96;
+  double value = length.length;
+
+  switch (length.unit)
+    {
+    case RSVG_UNIT_PX:
+      /* Already a pixel value.  */
+      break;
+    case RSVG_UNIT_CM:
+      /* 2.54 cm in an inch.  */
+      value = dpi * value / 2.54;
+    case RSVG_UNIT_MM:
+      /* 25.4 mm in an inch.  */
+      value = dpi * value / 25.4;
+      break;
+    case RSVG_UNIT_PT:
+      /* 72 points in an inch.  */
+      value = dpi * value / 72;
+    case RSVG_UNIT_PC:
+      /* 6 picas in an inch.  */
+      value = dpi * value / 6;
+    case RSVG_UNIT_IN:
+      value *= dpi;
+      break;
+    default:
+      /* Probably one of em, ex, or %.  We can't know what the pixel
+         value is without more information.  */
+      value = 0;
+    }
+
+  return value;
+}
+
 /* Load frame F and image IMG.  CONTENTS contains the SVG XML data to
    be parsed, SIZE is its size, and FILENAME is the name of the SVG
    file being loaded.
@@ -9792,11 +9830,48 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
 #if LIBRSVG_CHECK_VERSION (2, 46, 0)
   RsvgRectangle zero_rect, viewbox;
 
-  rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL,
-                                      &zero_rect, &viewbox,
-                                      NULL, NULL);
-  viewbox_width = viewbox.x + viewbox.width;
-  viewbox_height = viewbox.y + viewbox.height;
+  /* Try the instrinsic dimensions first.  */
+  gboolean has_width, has_height, has_viewbox;
+  RsvgLength iwidth, iheight;
+
+  rsvg_handle_get_intrinsic_dimensions (rsvg_handle,
+                                        &has_width, &iwidth,
+                                        &has_height, &iheight,
+                                        &has_viewbox, &viewbox);
+
+  if (has_width && has_height)
+    {
+      /* Success!  We can use these values directly.  */
+      viewbox_width = svg_css_length_to_pixels (iwidth);
+      viewbox_height = svg_css_length_to_pixels (iheight);
+    }
+  else if (has_width && has_viewbox)
+    {
+      viewbox_width = svg_css_length_to_pixels (iwidth);
+      viewbox_height = svg_css_length_to_pixels (iwidth)
+        * viewbox.width / viewbox.height;
+    }
+  else if (has_height && has_viewbox)
+    {
+      viewbox_height = svg_css_length_to_pixels (iheight);
+      viewbox_width = svg_css_length_to_pixels (iheight)
+        * viewbox.height / viewbox.width;
+    }
+  else if (has_viewbox)
+    {
+      viewbox_width = viewbox.width;
+      viewbox_height = viewbox.height;
+    }
+  else
+    {
+      /* We haven't found a useable set of sizes, so try working out
+         the visible area.  */
+      rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL,
+                                          &zero_rect, &viewbox,
+                                          NULL, NULL);
+      viewbox_width = viewbox.x + viewbox.width;
+      viewbox_height = viewbox.y + viewbox.height;
+    }
 #else
   /* The function used above to get the geometry of the visible area
      of the SVG are only available in librsvg 2.46 and above, so in
@@ -9809,6 +9884,19 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   viewbox_width = dimension_data.width;
   viewbox_height = dimension_data.height;
 #endif
+
+  if (viewbox_width == 0 || viewbox_height == 0)
+    {
+      /* We do not have any usable dimensions, so make some up.  The
+         values below are supposedly the default values most web
+         browsers use for SVGs with no set size.  */
+      /* FIXME: At this stage we should perhaps consider rendering the
+         image out to a bitmap and getting the dimensions from
+         that.  */
+      viewbox_width = 300;
+      viewbox_height = 150;
+    }
+
   compute_image_size (viewbox_width, viewbox_height, img->spec,
                       &width, &height);
 
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#44206: 28.0.50; SVG image fail to show
  2020-10-25 16:01 ` Alan Third
@ 2020-10-25 17:17   ` Sheng Yang
  2020-10-26 19:36     ` Alan Third
  0 siblings, 1 reply; 6+ messages in thread
From: Sheng Yang @ 2020-10-25 17:17 UTC (permalink / raw)
  To: Alan Third; +Cc: 44206

[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]

Thanks for your effort! Patch works for me, librsvg 2.50 on Archlinux. 

On Sun, Oct 25, 2020, at 11:01, Alan Third wrote:
> Anyway, I've thrown in another attempt at calculating the image size,
> and it works for this and also for the previous images. This one is
> more complex because it's trying to convert CSS sizes to pixel sizes
> and I don't think we can be entirely sure of some of them (like ex
> height? Maybe we can query that, but then we have to know font and
> font size).
> 
> I have no doubt that there are many more SVG files out there that
> won't display properly even with this patch.

I checked places where I use SVG files, especially telega, everything I checked looks good to me now. Hope there are not too many corner cases. 

> librsvg is really not helping here. The documentation makes it pretty
> clear that they don't want us to be querying the SVG dimensions and
> would prefer us to just give them the dimensions we want and/or to use
> Cairo.

So could the future of SVG in Emacs lie in Cairo? Forgive me if I am asking a dumb question.

> > Affected librsvg version: 2:2.50.1-1 in Archlinux, and 2.44.10-2.1 in Debian.
> 
> I'm concerned that librsvg 2.44 is affected as it should be using the
> same code path as before the commit in question.

My fault, librsvg 2.44 on Debian is NOT affect by this. (I guess I was having internet issue with my vps running debian. Last time I waited for a few seconds and the image was not showing up. I waited a bit longer this time.)


Sheng Yang(杨圣), PhD candidate
Computer Science Department
University of Maryland, College Park
E-mail: styang@fastmail.com
E-mail (old but still used): yangsheng6810@gmail.com


[-- Attachment #2: Type: text/html, Size: 2573 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44206: 28.0.50; SVG image fail to show
  2020-10-25 17:17   ` Sheng Yang
@ 2020-10-26 19:36     ` Alan Third
  2020-11-10  0:54       ` Sheng Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Third @ 2020-10-26 19:36 UTC (permalink / raw)
  To: Sheng Yang; +Cc: 44206

On Sun, Oct 25, 2020 at 12:17:16PM -0500, Sheng Yang wrote:
> Thanks for your effort! Patch works for me, librsvg 2.50 on Archlinux. 
> 
> On Sun, Oct 25, 2020, at 11:01, Alan Third wrote:
> > Anyway, I've thrown in another attempt at calculating the image size,
> > and it works for this and also for the previous images. This one is
> > more complex because it's trying to convert CSS sizes to pixel sizes
> > and I don't think we can be entirely sure of some of them (like ex
> > height? Maybe we can query that, but then we have to know font and
> > font size).
> > 
> > I have no doubt that there are many more SVG files out there that
> > won't display properly even with this patch.
> 
> I checked places where I use SVG files, especially telega,
> everything I checked looks good to me now. Hope there are not too
> many corner cases.

Thanks.

> > librsvg is really not helping here. The documentation makes it pretty
> > clear that they don't want us to be querying the SVG dimensions and
> > would prefer us to just give them the dimensions we want and/or to use
> > Cairo.
> 
> So could the future of SVG in Emacs lie in Cairo? Forgive me if I am
> asking a dumb question.

Not a dumb question. This came up a little while back and I think
there might be potential issues with getting Cairo on Windows, so it's
not necessarily a great solution.

One thing is that, in theory, if we were using SVGs for parts of the
UI, like fringe bitmaps, we wouldn't have to worry too much about
resizing and so on as we control the SVGs and can define them to suit
our uses.

> > > Affected librsvg version: 2:2.50.1-1 in Archlinux, and 2.44.10-2.1 in Debian.
> > 
> > I'm concerned that librsvg 2.44 is affected as it should be using the
> > same code path as before the commit in question.
> 
> My fault, librsvg 2.44 on Debian is NOT affect by this. (I guess I
> was having internet issue with my vps running debian. Last time I
> waited for a few seconds and the image was not showing up. I waited
> a bit longer this time.)

Ah, good to know. Thanks!
-- 
Alan Third





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44206: 28.0.50; SVG image fail to show
  2020-10-26 19:36     ` Alan Third
@ 2020-11-10  0:54       ` Sheng Yang
  2020-11-10 10:45         ` Alan Third
  0 siblings, 1 reply; 6+ messages in thread
From: Sheng Yang @ 2020-11-10  0:54 UTC (permalink / raw)
  To: Alan Third; +Cc: 44206

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

It has been some time since the last activity on this bug report, and the broken SVG display can be annoying for uses that need it, e.g. telega users.

@Alan: Is there any particular reason for not merging your patch to the master?


Sheng Yang(杨圣), PhD candidate
Computer Science Department
University of Maryland, College Park
E-mail: styang@fastmail.com
E-mail (old but still used): yangsheng6810@gmail.com


[-- Attachment #2: Type: text/html, Size: 942 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44206: 28.0.50; SVG image fail to show
  2020-11-10  0:54       ` Sheng Yang
@ 2020-11-10 10:45         ` Alan Third
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Third @ 2020-11-10 10:45 UTC (permalink / raw)
  To: Sheng Yang; +Cc: 44206-done

On Mon, Nov 09, 2020 at 06:54:22PM -0600, Sheng Yang wrote:
> It has been some time since the last activity on this bug report,
> and the broken SVG display can be annoying for uses that need it,
> e.g. telega users.
> 
> @Alan: Is there any particular reason for not merging your patch to
> the master?

Hi, sorry for the delay, it was pushed to master yesterday.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-10 10:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-25  3:25 bug#44206: 28.0.50; SVG image fail to show styang
2020-10-25 16:01 ` Alan Third
2020-10-25 17:17   ` Sheng Yang
2020-10-26 19:36     ` Alan Third
2020-11-10  0:54       ` Sheng Yang
2020-11-10 10:45         ` Alan Third

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).