The Right DPI
TL;DR Do not assume X11 is using the correct DPI for your screen. If your fonts look blurry and ugly, X11 might be using the wrong DPI value.
I recently installed ArchLinux on my brand new Lenovo T590. (Second Thinkpad in a row and I couldn’t be happier with the choice.)
The new computer has a FHD screen (1920x1080) and when I first started using it I was rather disappointed with font rendering: fonts looked blurry and I could see anti-aliasing trying its best but not being quite up to the point. Lucida fonts, in particular, looked so ugly I couldn’t use them.
Coming from a UHD display I thought the problem was with the hardware.
- I realized with
xdpyinfothat X11 was assuming the screen was 50 cm wide and set the dpi to 961
- I created the file
/etc/X11/xorg.conf.d/90-monitor.confwith the following data:
Section "Monitor" Identifier "<default monitor>" # Is it better to fake actual size to ensure a multiple of 96, such as 146 # DisplaySize 344 194 DisplaySize 334 187 EndSection
reboot … and voilà, nice fonts all over the screen!
it is actually the other way around: X11 set dpi to 96 and since the monitor is 1920 pixels wide, it must be 50cm long