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.

Pending

Ideas for discussion

Application-specific notes

GTK apps

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):

  1. echo Xft.dpi: 144 | xrdb -merge

  2. 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.

Chromium

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).