emacs-devel
[Top][All Lists]
Advanced

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

Re: High-res Customize icons


From: Clément Pit-Claudel
Subject: Re: High-res Customize icons
Date: Fri, 24 Apr 2020 22:55:13 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 23/04/2020 15.12, Eli Zaretskii wrote:
>> Cc: address@hidden, address@hidden
>> From: Clément Pit-Claudel <address@hidden>
>> Date: Thu, 23 Apr 2020 11:49:04 -0400
>>
>> I agree, but we need to solve two concrete issues with SVG scalable images 
>> before they are usable:
>>
>> * Automatic scaling (changing the font size automatically resizes icon 
>> fonts, but not images)
>> * Adjusting the background color (currently the SVG renderer uses the 
>> background color of the default face, while icon fonts use the right 
>> background color)
> 
> So let's fix them, that doesn't sound too difficult.

That's great to hear; it's often hard to know what's easy and what isn't ^^
Are these bugs tracked somewhere?  If not, here's a simple repro, which at 
least should provide a consistent recipe to start fixing the problem(s):

(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"))
    (put-text-property (point-min) (point-max) 'face '(:foreground "orange" 
:background "purple")))
  (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.
- For 3, the :foreground property should apply

For 5, it's a bit trickier.  One option would be to accept a float-valued 
:height specification and understand this as a multiple of the current font 
size?

The workaround for 2 is not too bad (add an explicit :background); for the 
other issues, it's quite bit trickier (for 1 it can be enough to set the size 
in the SVG, but that only works easily for SVGs created within emacs).

Sorry if this is redundant or if I missed something obvious,
Clément.





reply via email to

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