Bug 1943794 - GTK4 font rendering quality worse than GTK3
Summary: GTK4 font rendering quality worse than GTK3
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gtk4
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-27 13:17 UTC by James
Modified: 2022-08-16 21:50 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-16 21:33:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Screenshots comparing GTK4 and GTK3 font rendering (143.90 KB, image/png)
2021-03-27 13:17 UTC, James
no flags Details
Same comparison with GTK 4.0.3 on F33 (124.41 KB, image/png)
2021-03-27 22:28 UTC, James
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Fedora Pagure fedora-workstation issue 295 0 None None None 2022-08-16 21:33:40 UTC
GNOME Gitlab GNOME gtk issues 3787 0 None None None 2021-06-06 15:00:02 UTC

Description James 2021-03-27 13:17:52 UTC
Created attachment 1766890 [details]
Screenshots comparing GTK4 and GTK3 font rendering

Description of problem:
The font rendering of GTK4 is unexpectedly worse than GTK3. Primarily, the anti-aliasing does not respect hinting (or it is not hinting the same way as before) resulting in 'fuzziness' most visible on horizontal strokes.

The attached image compares GTK4 and GTK3 with their respective demo programs. Note the crisper rendering on the GTK3-side.

This is with RGB subpixel anti-aliasing and slight hinting enabled in both dconf and fonts.conf (reproduced below).

Version-Release number of selected component (if applicable):
gtk4-4.1.2-1.fc34.x86_64
gtk3-3.24.27-1.fc34.x86_64
pango-1.48.3-1.fc34.x86_64
freetype-2.10.4-3.fc34.x86_64
harfbuzz-2.7.4-3.fc34.x86_64

Expected results:
Glyphs rendered identically to GTK3.

fonts.conf content:
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>True</bool>
  </edit>
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
  <edit mode="assign" name="lcdfilter">
   <const>lcddefault</const>
  </edit>
 </match>
 <dir>~/.fonts</dir>
</fontconfig>

Comment 1 James 2021-03-27 22:28:35 UTC
Created attachment 1766990 [details]
Same comparison with GTK 4.0.3 on F33

Screenshots added for comparison: gtk4-4.0.3-1.fc33.x86_64 on Fedora 33 has what I consider the correct rendering behaviour.

Comment 2 Kalev Lember 2021-03-27 22:47:03 UTC
Could you file this upstream https://gitlab.gnome.org/GNOME/gtk, please?

Comment 3 Kalev Lember 2021-03-27 22:48:39 UTC
Actually, looks like there's already a ticket upstream: https://gitlab.gnome.org/GNOME/gtk/-/issues/3787

Comment 4 James 2021-03-27 22:52:06 UTC
(In reply to Kalev Lember from comment #3)
> Actually, looks like there's already a ticket upstream:
> https://gitlab.gnome.org/GNOME/gtk/-/issues/3787

Ah yes. Noted, I'll keep an eye on it.

Comment 5 Christian Stadelmann 2021-06-06 15:00:02 UTC
(In reply to Kalev Lember from comment #3)
> Actually, looks like there's already a ticket upstream:
> https://gitlab.gnome.org/GNOME/gtk/-/issues/3787

It seems like upstream denies the existence of this bug.

Comment 6 James 2021-06-25 23:24:09 UTC
Are all stakeholders/CCs here happy for me to close this bug as UPSTREAM (and subscribe to GNOME Gitlab #3787)? I don't think there's much point cluttering RHBZ by keeping it open here.

Comment 7 Michael Catanzaro 2022-08-16 21:09:41 UTC
We will deviate from upstream here.

Comment 8 Michael Catanzaro 2022-08-16 21:50:56 UTC
Well this is built for rawhide as gtk4-4.7.2-2.fc38. I'm having trouble building for F37 due to koji availability issues, but the patch is applied to the dist-git repo so it will get picked up next time somebody manages to build it.


Note You need to log in before you can comment on or make changes to this bug.