I've noticed that the icons for LibreOffice look rather bad on a HiDPI display. I've noticed this in stock Ubuntu 17.04, Kubuntu, and Ubuntu Gnome desktop. Is there a way to fix this?
2 Answers
I realize this is an old answer, but since I encountered the same problem on Ubuntu (Gnome) 20.04; LibreOffice 6.4.7.2 40, I will bother to answer anyway.
I am using an HDPI display (3840x2160 pixels; 192 dpi). Under 'Settings' > 'Display' > 'Scaling' the display scaling was globally set to 200%. Most applications deal well with this.
But the icons in LibreOffice remain blurry. Even, when .svg icon themes are selected. This is related to this bug, and to my understanding has to do with the rendering of .svg files in the GTK3 version of the app.
Playing around with the GDK scale, as mentioned here, I found that...
GDK_SCALE=1 SAL_FORCEDPI=192 libreoffice --writer
...solved this issue for me. You can add these environment variables to the .desktop files of the respective app launchers, if you do not wish to use the command line each time.
Explanation: The environment variable SAL_FORCEDPI=192
forces the application to start with the defined resolution, whose display support you can query using xrdb -query | grep -i dpi
. The .svg icons were rendered in a crisp manner. But this also lead to a duplication of the scaling value in my case; likely, because LibreOffice multiplies several scaling values. This was negated by enforcing GDK_SCALE=1
, which seems to fall back to the system-wide scaling of the correct 200% in my case.
Hope this helps.
-
What is meant by "whose display support you can query using
xrdb -query | grep -i dpi
". Are you saying that the value 192 is display-specific and that the user should use whatever number is returned byxrdb -query | grep -i dpi
? Jun 21, 2022 at 22:01 -
xrdb -query | grep -i dpi
will report your current screen DPI setting in the same way thatxdpyinfo | grep -B 2
resolution would do. In practice the display manager should automatically recognize the DPI support of your display, and set it accordingly. But What it doesn't set automatically is the screen scaling (default: 100%). If you have an HDPI display with a a DPI count that is different from the value 192, then you might want to take the value reported by the above-mentioned command and set the environment variableSAL_FORCEDPI
accordingly.– LUserJun 23, 2022 at 5:28 -
If you wanted to set the the environment variable automatically, then you could try a bash command substitution to the like of
SAL_FORCEDPI="$(xrdb -query | grep -i dpi | cut -f2)"
. As I don't want to type these command each time that I launch a LibreOffice application, I created a custom .desktop launchers for the apps. For example for LibreOffice Writer: # create a .desktop launcher withgedit ~/.local/share/applications/libreoffice-writer.desktop
.– LUserJun 23, 2022 at 5:36 -
# enter following lines (each string on a new line):
[Desktop Entry] Version=1.0 Name=LibreOffice Writer Terminal=false Icon=libreoffice-writer Type=Application Categories=Office;WordProcessor; Exec=/usr/bin/bash -c "GDK_SCALE=1 SAL_FORCEDPI=192 libreoffice --writer %U" StartupNotify=true X-GIO-NoFuse=true StartupWMClass=libreoffice-writer; Actions=NewDocument; [Desktop Action NewDocument] Name=New Document Icon=libreoffice-writer Exec=/usr/bin/bash -c "GDK_SCALE=1 SAL_FORCEDPI=192 libreoffice --writer" StartupWMClass=libreoffice-writer;
. # save and refresh the session.– LUserJun 23, 2022 at 5:41 -
Unfortunately didn't help much on my system (Linux Mint 21.1, 200% scaling): vertical and horizontal lines are sharp, but remaining, e.g. sloped lines, looks even more pixelated than before. And other parts of UI (menu bar, font selection field) became smaller.– gmk57May 13, 2023 at 9:56
On KDE Plasma you can go to "fonts" and force font dpi. In my case I forced "120".
Press the "Meta/Windows/Start" Button, type "fonts" open the fonts application. At the bottom of the windows is an option "Force fonds DPI". Check the box and set a DPI. Click here to see a picture of the fonts window
libreoffice-gtk3
installed (under xmonad). To test this you can just doEXPORT GDK_DPI_SCALE=1.5; localc
withEXPORT GDK_DPI_SCALE=1.0
it should be fine.