wingtk / gvsbuild

GTK stack for Windows
GNU General Public License v2.0
454 stars 170 forks source link

Rendering issues under Windows 10 and 11 #1405

Closed theCapypara closed 3 months ago

theCapypara commented 3 months ago

This is a follow-up to https://github.com/wingtk/gvsbuild/issues/1337

As I reported in that issue, I have really weird font rendering issues with gvsbuild under Windows 11. It seems to not just be isolated to font but also icons. I was able to reproduce this by just running the Adwaita demo app in 2024.8.0:

grafik grafik grafik grafik

What's really strange is that I've tried to go through the timeline again and am now a bit confused. I originally submitted a PR to patch out pango dwrite support to fix font rendering in GTK 3 (#1325). While that did fix font issues in GTK 3 it seemingly caused the issues I observe here with GTK 4. However that PR was reverted (#1338) and now it's still looking like this? After I originally reverted the PR the users that originally had these font rendeirng issues seemingly didn't have them anymore, it's all so strange. I was wondering, is it maybe #1328 that is causing this issue instead? In my original issue I just asumed it was my PR that broke rendering, but maybe it's that one, both were added at roughly the same time. I don't understand then why reverting my PR seemingly did fix it for a while. But at that time I was also not even able to really reproduce this on my own, so it's hard to say.

Of course it's also possible that neither of these PRs actually causes this...

I am also still not sure what actually needs to happen for this to occur. I can reproduce this on one of my Windows machines but not the others. The amount of corruption is also random with each launch.

theCapypara commented 3 months ago

Could it maybe be that any enabled direct write support, be it for harfbuzz, cairo or pango causes this? I am pretty sure I had my users test with a version of my fork again which had NEITHER #1325 or #1328 in them... (for GTK 4! I did test the PR with GTK 3 on its own) I can give that a go...

theCapypara commented 3 months ago

Disabling direct write again does not fix this issue.

theCapypara commented 3 months ago

I should also add that I ran the demo app with windbg to see which DLLs are loaded. Only system DLLs and DLLs of the GTK ecosystem are loaded.

theCapypara commented 3 months ago

I was told people are also experience this under Windows 10, but I can't reproduce it myself on my Windows 10 test machine.

jspast commented 3 months ago

I am also facing the exact same issue on Windows 11, and it seems to happen in Gaphor (which uses gvsbuild) as well: gaphor/gaphor#3352

danyeaw commented 3 months ago

What type of video card do you have? I am only able to reproduce the icon corruption on newer AMD Ryzen laptop.

theCapypara commented 3 months ago

On the PC where I can reproduce it I have an AMD Radeon RX 7800 XT, on the two where I can not reproduce this I have Intel integrated graphics 13th Gen and Virtio graphics driver (KVM/QEMU VM)

I'll do a survey with my users to see what graphics cards they have.

theCapypara commented 3 months ago

Another user with an AMD Ryzen CPU with hybrid graphics using an NVIDIA mobile GPU also experiences this issue, this is their screenshot they shared: grafik

theCapypara commented 3 months ago

Another user reports they have a NVIDIA GeForce GTX 1650 on a laptop with hybrid graphics.

danyeaw commented 3 months ago

Ok, to try to isolate what is causing this, let's do an Is / Is-not analysis:

Text and Icon Corruption

Category IS IS NOT
GPU Nvidia, AMD Intel
Windows Version 10 and 11
GTK Version GTK 4.14.4 GTK 3.24.43
Build System Gvsbuild MSYS2

Is that a good summary, and is there other things we should check?

theCapypara commented 3 months ago

That seems like a good summary. So far I had no reports of anybody using just Intel graphics to run into the issue.

I actually don't know if this issue happens with MSYS2. Last time I tested it (on the PC where I run into this issue) it didn't, but that's been quite a while ago.

theCapypara commented 3 months ago

I just tested it with MSYS2. I can not reproduce this issue, the fonts and icons look perfectly fine.

theCapypara commented 3 months ago

I asked on the MSYS2 Discord server, they pointed me to this patch they have: https://github.com/msys2/MINGW-packages/blob/365df49c1b798bb1bde02ac9986ae2edfb2c1088/mingw-w64-gtk4/PKGBUILD#L51C5-L52C51 https://github.com/msys2/MINGW-packages/blob/365df49c1b798bb1bde02ac9986ae2edfb2c1088/mingw-w64-gtk4/0001-ngl-icon-drawing-fix.patch

That seems promising! I won't have time to test it today or tomorrow (probably), I could give it a go after that.

The other patch they have supposedly fixes blurry font rendering: https://gitlab.gnome.org/GNOME/gtk/-/commit/b569470b87d143d30c2388046c9a6450696f19b8.patch

danyeaw commented 3 months ago

@theCapypara I couldn't reproduce the issue in MSYS2 either. Good find and teamwork with the MSYS2 team, I am building GTK4 now with the patch to test it.

danyeaw commented 3 months ago

@theCapypara This does fix the issue for me, I submitted #1408.

theCapypara commented 3 months ago

Great! We might also want to pull in the other patch in another PR, it really seems to improve font rendering for small fonts.

danyeaw commented 3 months ago

I think that 2nd patch is already in the latest GTK stable.

theCapypara commented 3 months ago

Ah. I haven't tested applying it yet, so it's possible, I thought the MSYS2 Adwaita demo had slightly sharper fonts than the gvsbuild one. I guess I could actually compare them later, maybe it was just my imagination.

TheSpartaPT commented 3 weeks ago

issue seems to be back ?

while trying to make a GTK4 application i noticed the text was not being anti-aliased, tried messing around with gtk-xft-antialias and gtk-xft-hinting Settings and as far as i can tell nothing changes visually.

Category
GPU Nvidia
Windows Version 11
GTK Version 4.16.3
Build System Gvsbuild@https://github.com/wingtk/gvsbuild/commit/733de98be46c4021e62c71579eaaedd3c01aa418

Examples:

image image

danyeaw commented 3 weeks ago

Please open a new issue rather than posting on one that has been closed for 2 months, thanks!