Steven D'Aprano composed on 2022-11-22 13:50 (UTC+1100):
On Tue, Nov 22, 2022 at 07:41:17PM -0400, Jim wrote:
A while ago I got tired of all the lies, counter-lies, counter-counter-lies, and so on, and now when I log in before much of anything gets started I figure out the correct DPI
And how do you do that, if X lies about the screen resolution?
It doesn't lie about resolution. It lies about screen size and screen pixel density (reported as DPI). The usual report is that the screen size is larger than the screen itself reports in order to be able to report and apply 96 DPI instead of an accurate DPI. This size report is usually found in /var/log/Xorg.0.log, but can be found via various utilities.
Xft.dpi: is one tool to set DPI to any arbitrary value, but not every DE or application responds to the Xft.dpi value. In many environments, there is no Xft.dpi by default. Gnome per upstream default forces it to 96 if it fails to find a value in the environment. Some distros force it to 96 in any case not determined to be a HiDPI environment. Xft.dpi is the method by which TCC Fonts (tdecmshell fonts) configures DPI.
xrandr --dpi sets the DPI on Xorg's environment that some apps respond to that do not respond to Xft.dpi. xrandr's DPI only applies to startups subsequently occurring, so must be applied as an X startup process to apply across the board. This value is ignored by most GTK apps, such as Firefox.
tdecmshell xserver
reports the DPI in effect at the xserver level, which /can/ differ from the Xft.dpi value, found thus:
xrdb -query | grep dpi
Xft.dpi is the means by which Gnome and various other environments "scale" fonts, and may scale the entire desktop, not including those apps that do not respond to Xft.dpi.