[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: High-res Customize icons
From: |
Yuan Fu |
Subject: |
Re: High-res Customize icons |
Date: |
Fri, 23 Oct 2020 12:39:44 -0400 |
> On May 1, 2020, at 9:46 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Wed, 22 Apr 2020 16:38:10 -0400
>> Cc: yandros@gmail.com,
>> cpitclaudel@gmail.com,
>> emacs-devel@gnu.org
>>
>> Here is a patch for the high-res icons. Put both icon files under
>> /etc/images/custom.
>>
>> In the patch I modified widget-image-find to look for @2x images. Can we
>> even modify find-image so it looks for @2x images (as an opt-in feature)?
>> That way Other applications (Magit, gdb-mi, etc) that uses images icons in
>> buffer and fringe could have high-res icons without changing a line of code
>> (assuming they use find-image).
>
> I think Emacs should look in the hi-res subdirectory when the display
> is high resolution. A defcustom sounds like a wrong way to handle
> this issue.
Thinking more about this, a hi-res subdirectory is useful for organizing files,
but shouldn’t be used for determining where to find high-res images. I suppose
you mean to have separate image-load-path and high-res-image-load-path? That
would be inconvenient for package authors, if they want to use image in their
package, they need to create two subdirectories for high and low resolution
image, add them to the two load-path, and use find-image. OTOH, if we use a
single image load-path and search for the @2x variant before the regular image,
package authors only need to name their images img.png and img@2x.png, and put
them under the package directory (since package directory is already in
load-path).
That’s about how to find the high-res variant of an image, determining whether
we want to use a high-res variant is another story. On hidpi screens, the OS
tells you the resolution of an area is 100x100, but the physical pixels in that
area could be in fact 200x200. That’s why an 100x100 image looks blurry. I
don’t think there is a reliable way to tell the current screen’s pixel density.
So I think a custom option is the most reliable and stable approach. If the
user wants this, they just set that variable.
Concretely, I mean a custom option like this:
(defcustom image-resolution-scaling-factor 1
"If greater than 1, try display high-res alternatives.
E.g., if the value is 2, `find-image' tries to find file@2x.png
for file.png."
:type '(choice number
(const :tag "1x" 1)
(const :tag "2x" 2)
(const :tag "3x" 3))
:version "28.1")
Yuan
- Re: High-res Customize icons, Yuan Fu, 2020/10/22
- Re: High-res Customize icons,
Yuan Fu <=
- Re: High-res Customize icons, Eli Zaretskii, 2020/10/23
- Re: High-res Customize icons, Yuan Fu, 2020/10/27
- Re: High-res Customize icons, Eli Zaretskii, 2020/10/27
- Re: High-res Customize icons, Alan Third, 2020/10/27
- Re: High-res Customize icons, Yuan Fu, 2020/10/27
- Re: High-res Customize icons, Alan Third, 2020/10/27
- Re: High-res Customize icons, YAMAMOTO Mitsuharu, 2020/10/27
- Re: High-res Customize icons, Yuan Fu, 2020/10/29