HiDPI display on Ubuntu 17.10 and font size

HiDPI display on Ubuntu 17.10 and font size

I have noticed the fonts are way too small in Ubuntu 17.10 on my laptop with 2560x1440 screen size.

I found that people "solve" this by enabling fractional scaling in Gnome 3.26 on Ubuntu 17.10 "artful" in the Wayland session.

This allows you to pick the display scale out of a wider range: 100%, 125%, 150%, 175%, 200%. (by default there is just 100% and 200%)

$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

Yet, by running xrandr in Gnome Terminal I have noticed that the display resolution was just shrunk.
This was not desirable for me, so I revert the change:

$ gsettings set org.gnome.mutter experimental-features []

And increased a text scaling factor (default is 1.0), which allowed me to keep my resolution 2560x1440 while having a normal font size:

$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.75

After that you may need to logout/login, since there is no graceful way to restart gnome-shell and leave the applications open, when using Wayland. 1 2

For some reason Gnome Text Editor (v3.22.1) did not pick the text scaling factor, so I had to increase the font size (from 13 up to 20) in its perferences menu explicitly.

Change console font size

With HiDPI display you may find your console font size is too small.
To change it:

$ sudo dpkg-reconfigure console-setup
Encoding: UTF-8
Character set: . Combined - Latin; Slavic Cyrillic; Greek
Font: Terminus
Font size: 14x28 (framebuffer only)

Run setupcon in the console session to apply the new font size immediately or restart Ubuntu.

QT and HiDpi

When you are using QT and the fonts are too small, just export one of the following variables, adjust the numbers as you wish:

export QT_DEVICE_PIXEL_RATIO=2 # is deprecated since Qt 5.4
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_SCALE_FACTOR=1.5
export QT_STYLE_OVERRIDE=GTK+ # use system font size

You can add one of these variables to /etc/profile.d/qt-hidpi.sh file so they will get automatically exported for every logged-in user.

In my case, QT_STYLE_OVERRIDE=GTK+ was enough to get the QT font size right in gnome-shell.

Sublime Text 3

Sublime Text 3 has full support for display scaling.
Go to Preferences > Settings > User Settings (right tab) and add "ui_scale": 1.75 to your settings.