Dots Per Inch (DPI) measures the number of dots or pixels per horizontal or vertical inch on a monitor.
The horizontal and vertical DPI is not always the same.
While X can report a different DPI for each physical monitor (through XRANDR extension), most of the time, applications will only exploit one value and won't adapt themselves when moving to one physical monitor to another.
X has typically assumed 96 DPI and this is fine for many traditional monitors. There are a range of newer Ultra High Definition (UHD) monitors, also referred to as 4K resolution, which typically have between 130 and 200 DPI. Handheld devices, some newer laptops and televisions also have significant variations in DPI.
If the physical DPI is much higher than what the software assumes, then fonts, icons or other graphical controls may appear very small.
As of Debian 8 (jessie), it is necessary to tweak several settings to make X and GNOME and other applications work well with non-standard DPI.
Whether or not this will improve in Debian 9 or later, possibly allowing the DPI value to be set in just one place and potentially auto-detected for many monitors, is undecided.
- should there be a release goal for simplifying this in stretch or later?
- should there be a BTS tag for HiDPI issues?
Ideas for discussion
- Create a database of monitors and their real resolution and physical dimensions, to supplement EDID data
- crowdsource the data, possibly using a setup wizard?
- does any other OS maintain such data and can it be used to seed such a project?
- prompt users to confirm they are satisfied with DPI on first login with a particular monitor
- should start trusting the values from the monitor EDID if they are in a range that is considered sane?
- create a list of recommended monitors for Linux users?
This section also applies to many other apps. For example, it has been tested to work with Emacs (Lucid version) and rxvt-unicode.
Most GTK apps will adjust the text size with the value of Xft/DPI in XSETTINGS. If not available, they will fallback to the value found in xrdb. Therefore, to get something somewhat good looking with most apps, you need (assuming you want to use DPI 144):
echo Xft.dpi: 144 | xrdb -merge
- Set Xft/DPI through XSETTINGS. Its value should be multiplied by 1024 (e.g 147456), unless already handled by the XSETTINGS daemon.
The last step can be done with a XSETTINGS daemon:
Applications using XSETTINGS will be notified on a change. This is handy on a laptop to adapt your applications to a screen change.
Firefox (Previously Iceweasel)
Recent Firefox (version 45 in stretch) detects DPI settings correctly.
If rendering is small in Firefox, open the page "about:config" and set config parameter layout.css.devPixelsPerPx to 2.
If location and tab bar text is too small, set GDK_SCALE="1" and GDK_DPI_SCALE="1" shell environment variables via ~/.profile for X.org or via ~/.config/environment.d/firefox.conf for Wayland.
Newer versions of Chromium (confirmed with version 49) detect DPI settings correctly.
Older versions of Chromium have issues with high DPI (seen in version 44). Chromium will use the ratio between Xft/DPI (as set through XSETTINGS) and the DPI reported by the X server (through xdpyinfo) as a scaling factor to be used. Therefore, for Chromium to work as expected, you need to keep your X server DPI to 96 dpi. Then, set Xft/DPI to the appropriate value.
In Chromium 46 and later, with GNOME, the above ratio can be overridden with the one from text-scaling-factor value in org.gnome.desktop.interface (this can be set with gsettings).