@maximuscore: That's a good question, has the font rendering on X11 been improved any. The short answer is no. However, I'm starting to wonder if the difference is really important. This time, I've taken a closer look at the font rendering in GTK 4.
With that said, I would like to show you more about the latest release of GTK 4, and the first stable release: GTK 4.0.0. Expect to see this release or a later micro release, such as GTK 4.0.8, in your favourite Linux distribution (perhaps Ubuntu or a derivative) soon.
I should also note, in big bold text, that I've been conducting most of these experiments on a 32-bit Intel system -- it's apparent that GTK 4 is not supposed to run on such systems. Nevertheless, my quick tests on borrowed 64-bit hardware reveal that similar mishaps occur on 64-bit hardware, too. If I had the time I would report the bug, but alas I don't right now -- should anyone else be truly annoyed by the bug, go ahead and report it.
OK, about the font rendering. On X11 the font rendering is still kind of ugly, showing unevenly thick letters:
This contrasts to Wayland, which doesn't show quite as much ugliness, although it's debatable whether it's perfect (in my opinion it's good enough):
You've seen this stuff before; the interesting part is: why is there a difference between the two? I first figured it had something to do with subpixel smoothing, i.e. placing coloured pixels next to otherwise unsmoothed text. The coloured pixels are intended to enable only the nearest colour components, a.k.a subpixels, to the unsmoothed text, thus making the text look even smoother than normal, "greyscale" smoothing, which uses light and dark shades of grey near the unsmoothed text to make the text look smoother. An example of subpixel smoothing on GTK+ 3.24.22:
It turns out that I was wrong; GTK 4 ignored my desktop settings, using greyscale smoothing even under Wayland. The following shows text (magnified to 7x) drawn by GTK 4 under X11 (left) and Wayland (right):
As you can see, no colours to be found in either; obviously, subpixel smoothing is not at play here. However, you may have noticed that the text under Wayland is lower contrast than the text under X11. I then figured that maybe other sub-pixel phenomena may be influencing this minor difference. Sure enough, a quick look at the GTK Inspector reveals that the text under X11 (left) is drawn on an uneven pixel boundary, whereas the text under Wayland is drawn on an even boundary (pertinent areas emphasised):
That's not to say that the Wayland version doesn't have a few bugs, however. The Size Groups demo under Wayland predictably distorts many of the fonts, no matter where you position the demo window:
But if you unfocus the window, the fonts clear up. Interesting. Note that this mishap does not appear on 64-bit hardware.
But I have a few closing notes. First off, should you want to try out GTK 4 yourself (I encourage doing so), you might prefer to hunt down a binary version from your distribution's repository (the testing versions of Fedora and Ubuntu might include it by the time you read this). However, GTK 4.0.0 has only been out for a few days as I write this, so I'm not expecting your distribution to carry it yet; as such you'll likely have to build it from source code. To do so, I warn you that you'll need at least the following dependencies (minimum versions required also included):
- Meson: 0.54.0
- GLib: 2.66.0
- Pango: 1.47.0
- FriBiDi: 0.19.7
- HarfBuzz: 0.9
- Cairo: 1.14.0
- GDK-PixBuf: 2.30.0
- GObject-Introspection: 1.39.0
- Graphene: 1.9.1
- Epoxy: 1.4
- SassC: No version explicitly requested.
Whew! That's a lot of dependencies! (Not really. There are plenty of software packages which require more dependencies than that.) If you're using Gentoo Testing (like I used for my GTK 4 experiments), you'll have the necessary versions of these packages already, apart from Pango. By the way, I installed Pango 1.47.0 system-wide for this GTK 4 test, to ensure that it wasn't the culprit of the font funkiness. It wasn't. If you're using another distribution, check your package manager to see which dependencies you'll need to build yourself.
Second, if you want a smooth experience, use 64-bit hardware. GTK 4 is not designed for 32-bit hardware of any kind. This is clear to me now.
Furthermore, graphics drivers play an even bigger role in GTK's stability than ever before. At one point I tried GTK 4.0.0 on Intel graphics hardware using the Mesa iris
driver. Occasionally on Wayland and X11, glitches would appear like this one:
When I switched to the alternative i965
driver, these glitches no longer appeared, but more minor ones started cropping up. Caveat user! In other words, your mileage may vary.
All right. That was a big, huge rant about GTK 4.0.0. Perhaps someone else has something more useful to say? Again, I encourage inquiring minds to try it out for themselves.
Also I feel sorry for the administrators here -- I try to keep the sizes of these images down to a minimum, but it still must be a huge drain.