FS#64450 - [pango] Incorrect rendering of fonts

Attached to Project: Arch Linux
Opened by Fedor Dostoyevskiy (bachtiar) - Monday, 11 November 2019, 03:05 GMT
Last edited by Balló György (City-busz) - Sunday, 18 June 2023, 09:33 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

Since pango-1:1.44-1, font rendering is broken and results in disfigured text.

See attached image for example.

This was tested in xfce with following:
Font: Tahoma TrueType font from Windows ttf-fonts, size 8
Enable anti-aliasing: off
Hinting: Full
Sub-pixel order: None

There were no other changes to the system except pango version.
Reverting to pango-1:1.43.0-2 solves the problem (this was the last working version released in Arch).
This task depends upon

Closed by  Balló György (City-busz)
Sunday, 18 June 2023, 09:33 GMT
Reason for closing:  No response
Additional comments about closing:  old report, probably upstream
Comment by mattia (nTia89) - Sunday, 12 April 2020, 15:53 GMT
I cannot reproduce the issue.
Is it still valid for you?
Comment by Fedor Dostoyevskiy (bachtiar) - Sunday, 12 April 2020, 21:02 GMT
Yes, as of 2020-04-12 current pango version is 1:1.44.7+11+g73b46b04-1 and is still the same issue as before. I verified with a fresh Arch install from scratch.

Did you try with the exact settings above (specifically antialias off etc.)?

I've done some more research and it seems that font rendering is very sensitive to display DPI setting. For reference, all my tests are at 96dpi (default). My impression is that there is some floating point rounding error - like certain values are being rounded in the wrong direction in the new version. The problem is emphasized when antialiasing is off, because it becomes obvious if it's not pixel-exact. The old version was pixel-exact at 96dpi. With the new version, if you change the DPI to 94 or 98, some of the artifacts disappear, but new ones start appearing. It's impossible to get it right. It also seems as if cairo and pango issues are somehow related.

If I can be of any more help, please let me know how. If you want, I can also send you the ttf-windows package to save you time.
Comment by mattia (nTia89) - Sunday, 12 April 2020, 21:29 GMT
I use GNOME, with tahoma font from WINE (aur package) and tweaks app for settings
and I cannot reproduce the issue.
Comment by Fedor Dostoyevskiy (bachtiar) - Monday, 13 April 2020, 03:45 GMT
That's a totally different scenario, I wouldn't say it counts as "can not reproduce".

I can also reliably reproduce the problem with
$ pango-view --font "Tahoma 8" --text "Accessibility"

The telltale sign is that letters A and C touch each other - this means that the bug is present. See attached PNG.

My fonts:
$ fc-list Tahoma
/usr/share/fonts/TTF/tahoma.ttf: Tahoma:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
/usr/share/fonts/TTF/tahomabd.ttf: Tahoma:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia

$ sha1sum /usr/share/fonts/TTF/tahoma*.ttf
bc34f23d506dc2886878d1af5bfd2f0ddcf2726a /usr/share/fonts/TTF/tahomabd.ttf
f43d7bf79be8b787d53f7b06a2d5136865aff169 /usr/share/fonts/TTF/tahoma.ttf
Comment by mattia (nTia89) - Monday, 13 April 2020, 08:05 GMT
The output of command `pango-view --font "Tahoma 8" --text "Accessibility"` looks perfect
but I used Tahoma ttf s from the AUR package [https://aur.archlinux.org/packages/ttf-tahoma/].

Please, can you try with this one?
Comment by Fedor Dostoyevskiy (bachtiar) - Monday, 13 April 2020, 18:06 GMT
I installed Tahoma font from https://aur.archlinux.org/packages/ttf-tahoma/. I made sure to remove the old one first.
Then I ran again 'pango-view --font "Tahoma 8" --text "Ac"'.
The pixels of "A" and "c" still touch each other, whereas there should be 1 pixel space in between.
So the issue is still there.
As far as I can see, text using Tahoma from WINE looks identical to text using Tahoma from ttf-win7-fonts, despite TTF files having a vastly different size (143884 vs. 698368 bytes).

Then I installed GNOME - same result. I noticed that GNOME manages fonts differently than XFCE - up to 12pt, antialiasing is off, at 13pt or more antialiasing is switched on automatically. I didn't find any setting for this, and neither for DPI nor hinting as in XFCE. However, pango-view with size 8pt, antialiasing is off and result looks exactly the same as in XFCE - fused "A" and "c".

Then I tried without any desktop, just with X:
$ echo 'pango-view --font "Tahoma 8" --text "Ac"' > ~/.xinitrc
$ rm -rf ~/.config ~/.local ~/.cache
$ startx

Same result. The problem seems 100% reproducible on my side. I'm baffled.

Note: my system is fully up-to-date as of now (2020-04-13), I'm running it in a QEMU/KVM with QXL video it matters anyhow.
Comment by mattia (nTia89) - Monday, 13 April 2020, 19:20 GMT
System-wide font settings (alias, font substitution, etc.) are placed in /etc/fonts folder.
Take a look there and/or "reset" those configuration file and restore default.
If it isn't an XFCE issue, then it (some strange mis-configuration file) could be the reason why I cannot reproduce it.

PS: I do not know if a virtual machine could affect a such kind of issue...
Comment by Fedor Dostoyevskiy (bachtiar) - Tuesday, 14 April 2020, 05:31 GMT
So now I went on and nuked the system.
Installed everything from scratch and I am able to confirm the issue.

Steps to reproduce:
$ pacstrap ...
$ echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
$ locale-gen
$ echo "LANG=en_US.UTF-8" > /etc/locale.conf
$ curl https://source.winehq.org/git/wine.git/blob/refs/heads/master:/fonts/tahoma.ttf > /usr/share/fonts/TTF/tahoma.ttf
$ fc-cache
$ echo 'pango-view --font "Tahoma 8" --text "fil"' > ~/.xinitrc
$ startx

Result: the letters f, i and l are touching.
Expected result: there should be 1 pixel of space between each two letters.

Running in VM is not relevant, I've verified the issue also on a non-VM installation.
Comment by stargazer (bernie) - Saturday, 18 April 2020, 18:08 GMT
I have the same problem with misaligned fonts in gtk apps since pango version 1.44 , version 1.43.0-2 is fine.

Comment by mattia (nTia89) - Saturday, 18 April 2020, 18:18 GMT
@bernie please share a screenshot
Comment by stargazer (bernie) - Saturday, 18 April 2020, 20:09 GMT
e.g. gtk file chooser , bad font alignment with latest pango version 1.44.x
Comment by stargazer (bernie) - Saturday, 18 April 2020, 20:10 GMT
e.g. gtk file chooser , good font alignment with pango version 1.43.x
Comment by 李 明 (Shaouai Du) - Wednesday, 13 May 2020, 11:49 GMT
Yes, downgrading to pango-1:1.43.0-2 does fix that in i3.
Comment by Balló György (City-busz) - Thursday, 08 June 2023, 14:29 GMT
Is this still an issue?

Loading...