GNU bug report logs -
#40845
SVG rendering issues
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sun, 23 Aug 2020 17:29:44 +0200 (CEST)
with message-id <20200823152941.GI89421 <at> breton.holly.idiocy.org>
and subject line Re: bug#40845: SVG rendering issues
has caused the debbugs.gnu.org bug report #40845,
regarding SVG rendering issues
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
40845: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=40845
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hi all,
As discussed on the mailing list, a number of issues currently exist with our SVG rendering implementation. I have tried to summarize the ones I'm aware of in the following example.
(with-current-buffer (get-buffer-create "*svg bugs*")
(erase-buffer)
(require 'face-remap)
(setq text-scale-mode-amount 10)
(text-scale-mode)
(let ((svg (svg-create 16 16)))
(svg-ellipse svg 8 8 4 4)
(insert "Text: ")
(print (svg-image svg :ascent 100))
(insert-image (svg-image svg :ascent 100))
(insert-image (svg-image svg :scale 5.0 :ascent 'center :foreground "red" :background "darkgreen"))
(add-text-properties
(point-min) (point-max)
'(face (:foreground "orange" :background "purple")
mouse-face '(:foreground "purple" :background "orange"))))
(pop-to-buffer (current-buffer)))
The issues:
1. Manually scaling an image, as is done for the second image, doesn't re-render the svg: is scales the bitmap-rendered version of it, causing blurriness.
2. The SVG images don't inherit the background of the current face; instead, they inherit the background of the default face.
3. The SVG images don't inherit the foreground of the current face; instead, they use a black foreground.
4. The :foreground keyword has no effect on svg images.
5. The images are not scaled with the text: changing text-scale-mode-amount doesn't change the size of the images.
For 1, 2, 3, and 4, the expected behavior is easy to define:
- For 1, the image should be scaled before being rasterized.
- For 2 and 3, the image should inherit the characteristics of the current face, and be re-rendered if that face changes (e.g. when mouse-face applies, which is important for buttons)
- For 4, the :foreground property should be respected
For 5, it's a bit trickier. One option would be to accept a float-valued :height specification and treat that as a multiple of the current font size.
A partial workaround for 2 is to add an explicit :background, but it doesn't help with face changes, such as applying a mouse-face. For 1 and 5 it can be enough to set the size in the SVG and add hooks, but that only works easily for SVGs created within emacs. For 3 and 4, I don't know of a workaround except modifying the SVG.
Cheers,
Clément.
[Message part 3 (message/rfc822, inline)]
On Sun, Aug 23, 2020 at 03:23:33PM +0300, Eli Zaretskii wrote:
> > Date: Sun, 23 Aug 2020 14:19:28 +0200 (CEST)
> > From: Alan Third <alan <at> idiocy.org>
> > Cc: cpitclaudel <at> gmail.com, 40845 <at> debbugs.gnu.org, pipcet <at> gmail.com
> >
> > *** The background and foreground of images now default to face
> > colors. When an image doesn't specify a foreground or background
> > color, Emacs now uses colors from the face used to draw the
> > surrounding text instead of the frame's default colors.
> >
> > To load images with the default frame colors use the ':foreground'
> > and ':background' image attributes, for example:
> >
> > (create-image "filename" nil nil
> > :foreground (face-attribute 'default :foreground)
> > :background (face-attribute 'default :background))
> >
> > This change doesn't affect image types that do not support foreground
> > and background colors, such as png or jpeg.
>
> Almost perfect: I would suggest to modify the last sentence so that it
> tells which types of images do support this feature.
Thanks. I've pushed it to master.
--
Alan Third
This bug report was last modified 4 years and 271 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.