bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59075: 29.0.50; Image transforms not applied to svg images


From: Evgeny Zajcev
Subject: bug#59075: 29.0.50; Image transforms not applied to svg images
Date: Sat, 12 Nov 2022 12:48:40 +0300



пн, 7 нояб. 2022 г. в 15:24, Po Lu <luangruo@yahoo.com>:
Evgeny Zajcev <lg.zevlg@gmail.com> writes:

> пн, 7 нояб. 2022 г. в 03:26, Po Lu <luangruo@yahoo.com>:
>
>  My suspicion is that librsvg is not being used to display SVGs at all,
>  on Mac OS 13.  What happens if you build without native image APIs?
>
> Works perfectly without native image API!  Resulting svg image gets correct size after applying `:height',
> and if I change image type to png, image is not displayed at all as expected.

Scratch what I said earlier.  Does this fix the problem?

diff --git a/src/nsimage.m b/src/nsimage.m
index 9cb5090dd0..dd8768664a 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -74,8 +74,10 @@ Updated by Christian Limpach (chris@nice.ch)
     imageType = @"com.compuserve.gif";
   else if (EQ (type, Qtiff))
     imageType = @"public.tiff";
+#ifndef HAVE_RSVG
   else if (EQ (type, Qsvg))
     imageType = @"public.svg-image";
+#endif
   else if (EQ (type, Qheic))
     imageType = @"public.heic";



Adding this code fixes the problem!  However, if I specify `png' image type instead of `svg' when svg image is in use, no error is triggered in contrast with Emacs without native images.

If this code does not break anything on older MacOS I think it should be added to Emacs.

If rsvg is present, there is no point in using native image APIs, as
they do not scale SVG images nearly as well.  And this part of
image_set_transform gets in the way:

#ifdef HAVE_RSVG
  /* SVGs are pre-scaled to the correct size.  */
  if (EQ (image_spec_value (img->spec, QCtype, NULL), Qsvg))
    {
      width = img->width / FRAME_SCALE_FACTOR (f);
      height = img->height / FRAME_SCALE_FACTOR (f);
    }
  else
#endif


--
lg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]