Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiDPI scaling is not supported #317

Open
newhoa opened this issue Jul 5, 2022 · 4 comments · May be fixed by #476
Open

HiDPI scaling is not supported #317

newhoa opened this issue Jul 5, 2022 · 4 comments · May be fixed by #476

Comments

@newhoa
Copy link
Contributor

newhoa commented Jul 5, 2022

Danielle Foré did a nice write-up on icons supporting HiDPI scaling here.

It requires some modification of the index.theme, adding some symlinked folders, and installing icons as SVG.

Currently this theme converts the SVGs to PNGs which saves space, but prevents HiDPI support.

This would require either SVG installation as an option, or simply moving to SVG-only.

@newhoa newhoa changed the title HiDPI is not supported HiDPI scaling is not supported Jul 5, 2022
@ochosi
Copy link
Member

ochosi commented Jul 6, 2022

The point about using pngs is not just size, it's really performance.
I would suggest we look into how to preserve as many icons as pngs (for lodpi) and add svgs to the theme where helpful.

@dccoder84
Copy link

dccoder84 commented Jun 8, 2023

I am using Xubuntu 23.04 and by default the icons on Xfdesktop are sharp on my 4K screen with window scaling set to 2x. But when I compile and install Xfdesktkop master then the icons are blurry so I thought there has to be a new bug in Xfdesktop. But Brian Tarricone searched for the bug. He said the old Xfdesktop version had a bug. It was rendering the icons not correctly but accidentally then the icons were rendered sharp. So the new master version is handling icon rendering correctly but then the icons are blurry. Brian investigated here and came to the conclusion the bug came from the theme. Look into his findings for more details. He also has some suggestions how to solve the problem. He thinks the problem is the index.theme file where lots of icons are declared as scalable but are PNG files. So I set all icons to fixed except for the scalable ones and that fixes the problem for Xfdestkop master. For example I changed this:

[actions/48]
Size=48
Context=Actions
Type=Scalable

to this:

[actions/48]
Size=48
Context=Actions
Type=Fixed

But I didn't touch for example this:

[actions/symbolic]
Size=16
Context=Actions
MinSize=8
MaxSize=512
Type=Scalable

You can download the full file here: index.theme.patched.zip

So is this a solution or is it too simple? Why should we set folders to scalable in the index.theme file when there are only PNG files? Does it depend on the distro or installation or what?

@bluesabre
Copy link
Member

I am using Xubuntu 23.04 and by default the icons on Xfdesktop are sharp on my 4K screen with window scaling set to 2x. But when I compile and install Xfdesktkop master then the icons are blurry so I thought there has to be a new bug in Xfdesktop. But Brian Tarricone searched for the bug. He said the old Xfdesktop version had a bug. It was rendering the icons not correctly but accidentally then the icons were rendered sharp. So the new master version is handling icon rendering correctly but then the icons are blurry. Brian investigated here and came to the conclusion the bug came from the theme. Look into his findings for more details. He also has some suggestions how to solve the problem. He thinks the problem is the index.theme file where lots of icons are declared as scalable but are PNG files. So I set all icons to fixed except for the scalable ones and that fixes the problem for Xfdestkop master. For example I changed this:

[actions/48]
Size=48
Context=Actions
Type=Scalable

to this:

[actions/48]
Size=48
Context=Actions
Type=Fixed

But I didn't touch for example this:

[actions/symbolic]
Size=16
Context=Actions
MinSize=8
MaxSize=512
Type=Scalable

You can download the full file here: index.theme.patched.zip

So is this a solution or is it too simple? Why should we set folders to scalable in the index.theme file when there are only PNG files? Does it depend on the distro or installation or what?

This sounds like the right solution. @ochosi, any feedback here?

@newhoa
Copy link
Contributor Author

newhoa commented Jul 5, 2023

@bluesabre I'm not ochosi but I'll comment anyway. :p

I think this is the right solution to fix some bluriness as long as they are PNG icons. There may be an issue in some places where an icon does not exist in one size, but does exist in another and then they will not scale when using this fixed method (for example, say view-refresh does not exist at 16px but does at 24px. I think in this case one icon in a menu would inflate the size of the menu because it would show at 24px and not scale it down to 16px). Using Min and Max in index.theme could be a possible solution for that.

But, it is not a solution for HiDPI. You end up with a few problems. First, it reduces the range of icons. Icon zoom levels are reduced because it doubles the size of the icons used. Instead of starting at 16px, you start at 32px. So instead of having 7 zoom levels (16px, 24px, 32px, 48px, 64px, 96px, 128px), you have 4 (32px, 48px, 64px, 96px).

Second, it uses the wrong icons.

Scaling Factor 1 uses 16px icons:
sf1

Scaling Factor 2 uses 32px icons for the 16px zoom level:
sf2

This also goes for menus, toolbars, mimetypes, etc. where the icons meant for specific purposes aren't being used. It reduces clarity since smaller icons are visually different than larger ones with more detail. This was the result of the solution @kelnos first used for Xfce but then switched it to use the intended Gtk load_icon_for_scale where it looks in HiDPI folders (16x16@2x) as documented in the Danielle Fore post in the original post here. (little more detail and discussion here on Xfce gitlab)

I don't know a proper HiDPI solution while keeping PNG icons short of remaking every PNG icon at 2x the size.

The downside to switching to SVG would be the larger package size (ochosi mentioned speed, but I think that shouldn't be an issue with the gtk icon-cache, esp with any semi-modern computer). But I think that's the best solution. It's what Gtk and Qt expect, it's what other major icon themes have moved to, it's in the FreeDesktop.org spec, it's what hicolor uses/supports now, and it's what Xfce looks for since 4.18.

newhoa added a commit to newhoa/elementary-xfce that referenced this issue Apr 5, 2024
Add an optional --hidpi configure flag to allow installing
as a fully SVG theme, with an updated index.theme for HiDPI
support. This will be seen when Scaling is set to 2x or 3x.

Fixes issues where wrong icons are shown in some places with
scaling enabled (like the Places sidebars in file managers),
and blurry icon issues, especially with scaling enabled.
The PNG non-HiDPI theme also restricted the amount of zoom
steps the icons had with scaling enabled, so this should
resolve that as well.

Fixes shimmerproject#124
Fixes shimmerproject#317
Fixes shimmerproject#362
Fixes shimmerproject#403
newhoa added a commit to newhoa/elementary-xfce that referenced this issue Apr 5, 2024
Add an optional --hidpi configure flag to allow installing
as a fully SVG theme, with an updated index.theme for HiDPI
support. This will be seen when Scaling is set to 2x or 3x.

Fixes issues where wrong icons are shown in some places with
scaling enabled (like the Places sidebars in file managers),
and blurry icon issues, especially with scaling enabled.
The PNG non-HiDPI theme also restricted the amount of zoom
steps the icons had with scaling enabled, so this should
resolve that as well.

Fixes shimmerproject#124
Fixes shimmerproject#317
Fixes shimmerproject#362
Fixes shimmerproject#403
newhoa added a commit to newhoa/elementary-xfce that referenced this issue May 16, 2024
Add an optional --hidpi configure flag to allow installing
as a fully SVG theme, with an updated index.theme for HiDPI
support. This will be seen when Scaling is set to 2x or 3x.

Fixes issues where wrong icons are shown in some places with
scaling enabled (like the Places sidebars in file managers),
and blurry icon issues, especially with scaling enabled.
The PNG non-HiDPI theme also restricted the amount of zoom
steps the icons had with scaling enabled, so this should
resolve that as well.

Fixes shimmerproject#124
Fixes shimmerproject#317
Fixes shimmerproject#362
Fixes shimmerproject#403
newhoa added a commit to newhoa/elementary-xfce that referenced this issue May 16, 2024
Add an optional --hidpi configure flag to allow installing
as a fully SVG theme, with an updated index.theme for HiDPI
support. This will be seen when Scaling is set to 2x or 3x.

Fixes issues where wrong icons are shown in some places with
scaling enabled (like the Places sidebars in file managers),
and blurry icon issues, especially with scaling enabled.
The PNG non-HiDPI theme also restricted the amount of zoom
steps the icons had with scaling enabled, so this should
resolve that as well.

Fixes shimmerproject#124
Fixes shimmerproject#317
Fixes shimmerproject#362
Fixes shimmerproject#403
newhoa added a commit to newhoa/elementary-xfce that referenced this issue May 16, 2024
Add an optional --hidpi configure flag to allow installing
as a fully SVG theme, with an updated index.theme for HiDPI
support. This will be seen when Scaling is set to 2x or 3x.

Fixes issues where wrong icons are shown in some places with
scaling enabled (like the Places sidebars in file managers),
and blurry icon issues, especially with scaling enabled.
The PNG non-HiDPI theme also restricted the amount of zoom
steps the icons had with scaling enabled, so this should
resolve that as well.

Fixes shimmerproject#124
Fixes shimmerproject#317
Fixes shimmerproject#362
Fixes shimmerproject#403
newhoa added a commit to newhoa/elementary-xfce that referenced this issue Aug 24, 2024
Install SVG-based HiDPI theme alongside the PNG-based theme.
This should be used for better icon scaling, specifically when
Scaling is set to 2x or 3x. PNG may be a bit faster to load,
so the SVG HiDPI theme is optional.

Using the HiDPI theme will fix issues where the wrong icons are shown in
some places with scaling enabled (like the Places sidebars in file managers).
It should also fix and blurry icon issues, especially with scaling enabled.
The PNG non-HiDPI theme restricted the amount of zoom steps the icons had
in file managers with scaling enabled, so this should resolve that as well.

Fixes shimmerproject#124
Fixes shimmerproject#317
Fixes shimmerproject#362
Fixes shimmerproject#403
@newhoa newhoa linked a pull request Aug 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants