Bug 150973 - Use only SVG for the toolbar icons
Summary: Use only SVG for the toolbar icons
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 161157 (view as bug list)
Depends on:
Blocks: HiDPI Icon-Themes-Code Icon-Themes-Code-SVG
  Show dependency treegraph
 
Reported: 2022-09-15 12:04 UTC by Hossein
Modified: 2024-05-18 12:51 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot with blurry icons (39.20 KB, image/png)
2022-09-15 19:23 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2022-09-15 12:04:05 UTC
This is a proposal to have only SVG icons. Using SVG, which is a vector format, allows to display the icons very crisp on various different displays. This is not always possible with the icons in raster formats like PNG.

As discussed in tdf#144583, the current PNG icons are displayed blurry on HiDPI displays. We also have SVG icons that are now displayed very crisp on HiDPI displays, because of the fix for the aforementioned bug.

Quoting from Caolan:

"Maybe for the png case it would be nicer to have the pngs available in different sizes to begin with so a suitable size would be available rather than upscaling a smaller one, or maybe svg only is the right way to go eventually."

Having SVG only icons is a better approach, because of the use of fractional scaling leads to multiple/unknown icon sizes.

Therefore, I suggest to deprecate PNG icons, and have only SVG icons.
Comment 1 V Stuart Foote 2022-09-15 14:11:48 UTC
But we do not use the SVG icons directly. They are currently rendered (with scaling appropriate to fractional scale of the UI -- see bug 115439) to PNG

The PNG packaged look better bcz they are designed at 16px 24px and 32px--modeled against the source SVG.  Resampling of the source SVG for scaling only becomes useful at fractional scaling from 150% upward.

So yes to direct use of SVG.

Yes to automatically switching to the os/DE appropriate SVG icon theme.

But, NO to dropping the packaged PNG for UI < 150% fractional scaling.
Comment 2 Rafael Lima 2022-09-15 14:26:46 UTC
For 100% scaling on a 1080p display it's better to use PNG icons. When I use the SVG version the icons look blurry due to resampling.
Comment 3 Hossein 2022-09-15 18:55:29 UTC
(In reply to Rafael Lima from comment #2)
> For 100% scaling on a 1080p display it's better to use PNG icons. When I use
> the SVG version the icons look blurry due to resampling.
What is your operating system? Caolan recently fixed such a problem for Linux/gtk in tdf#144583.

Could you please test with the latest LO master?
Comment 4 V Stuart Foote 2022-09-15 19:09:49 UTC
(In reply to Hossein from comment #3)
> (In reply to Rafael Lima from comment #2)
> > For 100% scaling on a 1080p display it's better to use PNG icons. When I use
> > the SVG version the icons look blurry due to resampling.
> What is your operating system? Caolan recently fixed such a problem for
> Linux/gtk in tdf#144583.
> 
> Could you please test with the latest LO master?

Uh, no he didn't.  Status quo, the SVG would be converted to PNG directly but not scaled. Exactly the reason the bundled PNG (optimized by the graphics designer) for use at 100% unscaled UI.

An SVG "converted"/"resampled" to PNG at the 16px/24px/32px resolution needed by the unscaled UI, i.e. 100% will always look inferior to a directly edited PNG at those sizes/scale.
Comment 5 Rafael Lima 2022-09-15 19:23:43 UTC
Created attachment 182471 [details]
Screenshot with blurry icons

Hi Houssein, I tested with today's master build and the icons still look blurry on my 1920 x 1080 display. See attached screenshot pointing to some blurry icons.

I'm using Kubuntu 22.04 (KDE Plasma 5.25.5).

Tested with

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 35702fd6781542f5eefbd3710304ab9a25ac61fe
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: threaded
Comment 6 V Stuart Foote 2022-09-15 20:11:49 UTC
(In reply to Rafael Lima from comment #5)
> Hi Houssein, I tested with today's master build and the icons still look
> blurry on my 1920 x 1080 display. See attached screenshot pointing to some
> blurry icons.

The PNG icons, or the SVG icons or both?
Comment 7 Hossein 2022-09-15 21:05:27 UTC
(In reply to V Stuart Foote from comment #4)
> > Caolan recently fixed such a problem for
> > Linux/gtk in tdf#144583.
> > Could you please test with the latest LO master?
> Uh, no he didn't.  Status quo, the SVG would be converted to PNG directly
> but not scaled. Exactly the reason the bundled PNG (optimized by the
> graphics designer) for use at 100% unscaled UI.
> 
> An SVG "converted"/"resampled" to PNG at the 16px/24px/32px resolution
> needed by the unscaled UI, i.e. 100% will always look inferior to a directly
> edited PNG at those sizes/scale.
It is possible to have very low-res "16px/24px/32px" icons to use wherever needed, and rasterize SVG elsewhere. Btw, if the rasterization routines are problematic and produce low quality results, why not fix them to achieve better results?

If the graphical back-ends can render SVG themselves, asking them to render would be much better. If that's what you meant by "direct use of SVG", I agree with you that it would be better.
Comment 8 Rafael Lima 2022-09-15 22:13:54 UTC
(In reply to V Stuart Foote from comment #6)
> The PNG icons, or the SVG icons or both?

The SVG icons look blurry, even with the latest master build. PNG icons look crispy.
Comment 9 V Stuart Foote 2022-09-15 22:36:00 UTC
(In reply to Rafael Lima from comment #8)

> The SVG icons look blurry, even with the latest master build. PNG icons look
> crispy.

Yes, and that is to be expected.  Automated downscale resampling of SVG into PNG icons can not match quality of PNG icon theme hand edited for use in UI at 100%. 

The SVG icon theme are only appropriate as the UI scaling factor increases and the need for higher resolution icons emerges to avoid pixilation. Using SVG icons in the UI with no scaling or minimal 1.25x scaling results in icon theme that seems "smeared" compared to the bundled PNG icon themes appropriate for the resolution.
Comment 10 Hossein 2022-09-20 10:11:39 UTC
Caolan, what do you think about this issue?
Comment 11 Caolán McNamara 2022-09-20 10:29:18 UTC
something like gnome provides icons in some pixel sizes and then a scalable version, e.g.

$ ls /usr/share/icons/Adwaita/
16x16  22x22  24x24  256x256  32x32  48x48  512x512  64x64  8x8  96x96 scalable

an arrangement like that sounds plausible to me, bundle say "colibre" and "colibre_svg" together into a single "colibre" zip/package with a "scalable" subdir of the svg version and a 32x32 (?) of the png version. And prefer a concrete pixel version if its present and is at the requested size while use the scalable one if the requested size is larger.
Comment 12 Roman Kuznetsov 2022-11-01 18:44:24 UTC
I remember that LO had some problems with the SVG->PNG icon converting. I mean LibreOffice doesn't show the SVG icons directly, first it converts SVG to PNG

Tomaz, what do you think today about the suggestion? Is there today some technical reason to have PNG icon themes and don't use only SVG for all icons?
Comment 13 Tomaz Vajngerl 2022-12-01 06:47:10 UTC
(In reply to Roman Kuznetsov from comment #12)
> I remember that LO had some problems with the SVG->PNG icon converting. I
> mean LibreOffice doesn't show the SVG icons directly, first it converts SVG
> to PNG
> 
> Tomaz, what do you think today about the suggestion? Is there today some
> technical reason to have PNG icon themes and don't use only SVG for all
> icons?

I don't think anything changed. There are some bugs that need discovering and fixing in the SVG importer, drawinglayer, outputdevice, backend to get rendering sizes correctly.
Comment 14 V Stuart Foote 2024-05-18 12:51:31 UTC
*** Bug 161157 has been marked as a duplicate of this bug. ***