stretched TT fonts (wrong aspect ratio) across all x11 applications (xfwm4 in use)

From: Harry Schmalzbauer <freebsd_at_omnilan.de>
Date: Wed, 27 Dec 2023 09:08:13 UTC
Hello,

after some years, I updated my x11 setup here (same applications with 
differing versions, now: xfce-4.18_1 on xorg-server-21.1.10,1 with 
i915kms+modesetting, libinput).

Unfortunately, all truetype/otf fonts are rendered wrong.  They appear 
widened, which affects all GTK/QT applications and xterm/urxvt likewise.
Not sure if it is vertically condensed or horizontally stretched...

My 1st guess was that my three different monitors (with differing aspect 
ratios) on one xinerama screen could be the culprit and switched back to 
3 independent (non-xinerama) screens, but that leads to one more 
problem: xfwm4 seems to have dropped support for more than one $DISPLAY.
So I tried a single monitor-single screen config.  Still the fonts are 
'stretched'.

I couldn't find posts mentioning such error - likely that there aren't 
many people noticing that (eg. 4:3 footage wrong scaled to 16:9 doesn't 
bother my wife, while I'm getting headache).

Most striking if you have a RDP connection (window) showing e.g. a PuTTY 
on Windows using the same font (Bitstream Vera Mono or Lilex - my new 
favourite) like with local xterm/urvt.  The xterm (urxvt) looks 
completely different on X11, horizontally blown up.
The difference slightly varies with unmatched font sizes, but the X11 
output is always stretched (not only in xterm/urxvt, but wrong in all 
x11 apps).
Of course the different anti-alias methods always resulted in slightly 
different font rendering output between Windows and X11, but I'm not 
talking about that minor differences, but really significant 
horizontally widened truetype fonts!  It doesn't seem to be just the 
spacing, but the complete aspect ratio is wrong (horizontally stretched 
or vertically condensed).

I don't know where to start searching - altering DPI values influences 
the scaling symmetrically.
Any hints highly appreciated, I don't have much clue about xft!

Like mentioned, this mis-rendering is present across all x11 
applications (generally all GTK/QT apps, while e.g. Firefox's website 
rendering seems to be unaffected - hard to tell because I only have 
those fonts installed which are dependencies of applications I use, plus 
Lilex and BitstreamVeraMono)


Here's a rough outline about my setup:

fc-cat | grep VeraMono.ttf
/home/user1001/.local/share/fonts: No such file or directory
/usr/share/fonts: No such file or directory
/home/user1001/.fonts: No such file or directory
"VeraMono.ttf" 0 "Bitstream Vera Sans 
Mono:familylang=en:style=Roman:stylelang=en:fullname=Bitstream Vera Sans 
Mono:fullnamelang=en:slant=0:weight=80:width=100:spacing=100:foundry=Bits:index=0:outline=True:scalable=True:charset=20-7e 
a0-ff 106-107 10c-10d 111 11e-11f 130-131 141-142 152-153 15e-161 178 
17d-17e 192 2c6-2c7 2d8-2dd 3a9 3c0 2013-2014 2018-201a 201c-201e 
2020-2022 2026 2030 2039-203a 20ac 2122 2202 2206 220f 2211-2212 2215 
2219-221a 221e 222b 2248 2260 2264-2265 25ca 
fb01-fb02:lang=aa|ay|bi|br|ch|co|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|nso|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|tn|tr|ts|uz|vo|vot|wa|xh|yap|zu|an|crh|fil|ht|jv|kj|ku-tr|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za:fontversion=131072:fontformat=TrueType:decorative=False:postscriptname=BitstreamVeraSansMono-Roman:color=False:symbol=False:variable=False:fonthashint=True:order=0"

xrandr
Screen 0: minimum 320 x 200, current 5680 x 1600, maximum 16384 x 16384
DP-1 connected primary 2560x1600+1920+0 (normal left inverted right x 
axis y axis) 641mm x 401mm
    2560x1600     59.97*+
HDMI-1 connected 1200x1600+4480+0 left (normal left inverted right x 
axis y axis) 432mm x 324mm
    1600x1200     60.00*+
HDMI-2 disconnected (normal left inverted right x axis y axis)
DP-2 connected 1920x1200+0+185 (normal left inverted right x axis y 
axis) 519mm x 324mm
    1920x1200     59.95*+


Maybe a wrong default anywhere in '/usr/local/etc/fonts/conf.d/'?


Best,

-harry