High DPI under Linux (Debian)

For a long while, I've run with a mish-mash of settings in order to get the fonts and icons in various applications "just right" on my high DPI displays. Today I upgraded packages to Debian Bookworm, and various things randomly started using huge fonts.

Being a bit grumpy about this, from now on I'm going to fix any DPI setting to the correct value (about 176 in my case), and then try and force applications to look right. With luck, this should mean reasonable results on displays with different DPIs just by changing the toolkit configurations.

This new "breakage" could actually be a symptom of more applications starting to do things properly (scaling fonts depending on DPI), but having bad defaults. Maybe application authors are setting these defaults based on a poorly-configured machine - e.g., a high DPI display but with no DPI toolkit settings. Of course, some apps clearly don't get to make that excuse.

DPI settings

In .xsession / .xinitrc:

/usr/bin/xrandr --dpi 176

In .xsettingsd (DPI × 1024):

Xft/DPI 180224

In .Xresources:

Xft.dpi: 176


Gtk UI elements

Shared across lots of applications, and the Xfce panel. In .xsettingsd:

Gtk/FontName "Noto Sans Regular 7"
Gtk/MonospaceFontName "Monospace Regular 8"


These lines in .Xresources work for me:

*.vt100.faceName: DejaVu Sans Mono
*.vt100.faceSize: 5.7
*.vt100.scaleHeight: 1.05


After updating to "Bookworm", the UI fonts were much embiggened. The change in behaviour seems to have come in with a change to use "render tables". This seems to be a Motif 2 thing.

Debian Xpdf git repo

96878f5a7050b99a7187eed864779dcceb436b68 is the first bad commit
commit 96878f5a7050b99a7187eed864779dcceb436b68
Author: Adam Sampson 
Date:   Wed Mar 3 21:46:24 2021 +0000

    Use render tables to select Xft Unicode fonts for the UI.

It can be worked around by adding these lines to .Xresources:

Xpdf*renderTable.default.fontSize: 5
Xpdf*renderTable.mono.fontSize: 5


Similarly huge fonts with the transition to version 6.02, but I've not so easily been able to narrow down what change caused this. There didn't seem to be any similar transition to "render tables" in the code, but fonts in app-defaults are in the form "sans-serif bold 16", etc., so a workaround is to specify these with smaller values, in .Xresources:

XScreenSaver*Dialog.headingFont:    sans-serif bold 10
XScreenSaver*Dialog.bodyFont:       sans-serif 8
XScreenSaver*Dialog.errorFont:      sans-serif bold 8
XScreenSaver*Dialog.labelFont:      sans-serif bold 8
XScreenSaver*Dialog.unameFont:      sans-serif 6
XScreenSaver*Dialog.buttonFont:     sans-serif bold 8
XScreenSaver*Dialog.dateFont:       sans-serif 5

Note: XScreenSaver prior to 6.x doesn't know what to do with those font names, so wait until you need them.


I'm guessing a lot of the problems with browsers comes from images not reliably having presentation DPI information in them. You can scale a font because you know how big it's supposed to be, but for an image, the best you can do is assume "what displays used to be like". Probably 96DPI.

Even so, the way to configure that in Firefox is a bit mad. It is affected by the settings in .xsettingsd, but the end result of the UI text is much smaller than other Gtk users. What you then do is apply a scale factor to everything. End result: both images and text look right. Except the scale down doesn't seem to be in the same proportions, so the scale up ends up being a pretty random looking number. It's possible this only happens to work ok for the DPI of my screen.

In about:config, set layout.css.devPixelsPerPx to 1.375.

In Settings → General → Language and Appearance, set content fonts and sizes to whatever you're comfortable with. I'm happy with CMU Bright at size 15.

Not fixed: at higher DPI, scrollbar widths become super small. There are userChrome/userContent based (apparent) fixes for this online but I've not investigated them yet.


I can't make head nor tail of this one, but it does at least have enough sliders to make things look right.

In User Settings → Appearance, set Chat Font Scaling to 15px, and Zoom Level to 75.

Discord will then want to waste lots of your screen space by not allowing you to make the window smaller. Put these lines at the top level in ~/.config/discord/settings.json:

  "MIN_WIDTH": 0,
  "MIN_HEIGHT": 0,

The splash screen as it's starting stays large, but that's short-lived.


Absolutely no idea. You can make the content the right size easily enough, but it seems to be using yet another scaling method for icons and UI, so they all look huge. The available settings seem to be incredibly minimal, but as this isn't my primary browser - I only fire it up to test stuff - I don't care enough to dig deeper.

Updated 4 Apr 2022