Bug 479891 - Some text glyphs in QML software are vertically mis-aligned or squished when using a fractional scale factor
Summary: Some text glyphs in QML software are vertically mis-aligned or squished when ...
Status: RESOLVED FIXED
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: VHI normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords: qt6
: 481233 482633 482720 482746 482928 483112 485647 486039 487899 488623 489076 489101 489845 491258 494217 496579 496726 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-01-16 12:08 UTC by Michel Le Bihan
Modified: 2024-12-01 17:51 UTC (History)
78 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot1 (2.03 MB, image/png)
2024-01-16 12:08 UTC, Michel Le Bihan
Details
Screenshot2 (2.01 MB, image/png)
2024-01-16 12:09 UTC, Michel Le Bihan
Details
In Discover (46.92 KB, image/jpeg)
2024-01-17 00:09 UTC, Nate Graham
Details
In NeoChat (31.84 KB, image/jpeg)
2024-01-18 15:49 UTC, Nate Graham
Details
Yikes in NeoChat (102.79 KB, image/jpeg)
2024-01-18 17:58 UTC, Nate Graham
Details
aligned-scale-test-100% (957.27 KB, image/png)
2024-01-22 10:49 UTC, Michel Le Bihan
Details
aligned-scale-test-125% (812.69 KB, image/png)
2024-01-22 10:50 UTC, Michel Le Bihan
Details
aligned-scale-test-150% (440.08 KB, image/png)
2024-01-22 10:50 UTC, Michel Le Bihan
Details
aligned-scale-test-175% (341.86 KB, image/png)
2024-01-22 10:50 UTC, Michel Le Bihan
Details
1920x1080 125% (System settings dialog) (20.12 KB, image/jpeg)
2024-03-07 15:27 UTC, Alexey
Details
1920x1080 125% (System settings dialog 2) (32.57 KB, image/jpeg)
2024-03-07 15:27 UTC, Alexey
Details
1440p@125% - Normal Settings Window (30.21 KB, image/png)
2024-04-28 15:10 UTC, dft
Details
Kmail horrible font @ 125% 3440x1440 (81.37 KB, image/png)
2024-05-13 18:10 UTC, Lucas
Details
Screenshot of Konsole toolbar on X11, 150% fractional scaling, Qt rounding policy set (6.29 KB, image/png)
2024-06-20 07:30 UTC, gilles
Details
The worst one ive seen @ 150% 1440p (46.57 KB, image/png)
2024-06-23 15:43 UTC, derek
Details
System Settings - Overview (Applications) 1920x1080@125% (41.28 KB, image/png)
2024-06-27 13:31 UTC, Pavel Dobiáš
Details
Screenshot: SystemSettings::Sound volume (1.25 scaling, Plasma 6.1.2 with Qt6.7.2 on F40) (48.04 KB, image/png)
2024-07-20 12:29 UTC, postix
Details
bad text alignment on plasma 6.1.3 wayland (4K 150%) (127.71 KB, image/png)
2024-08-14 17:47 UTC, dofficialgman
Details
Minimal reproducing case with Qt 6.8.0 (109.87 KB, image/png)
2024-10-10 20:32 UTC, gilles
Details
overlay applied, text still messy (55.58 KB, image/avif)
2024-11-15 01:53 UTC, Luis
Details
Dolphins preview (109.46 KB, image/png)
2024-11-27 10:29 UTC, Robby Engelmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Le Bihan 2024-01-16 12:08:26 UTC
SUMMARY
When fractional scaling is enabled, there are some weird artifacts in the text


STEPS TO REPRODUCE
1. Set scaling to 175% (or 125%)
2. Open Kickoff
3. Notice that some letters don't look good

OBSERVED RESULT
Some letters look very ugly. Please see the o in `Dolphin` in Screenshot1 and the `System Monitor` and the m in `Samba Status` in screenshot2.

EXPECTED RESULT
Text should be rendered correctly

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 5.92.0
KDE Frameworks Version: 5.248.0
Qt Version: 6.6.1
Kernel Version: 6.8.0-0.rc0.20240112git70d201a40823.5.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® Xe Graphics
Manufacturer: LENOVO
Product Name: 20TA000EPB
System Version: ThinkPad E14 Gen 2

ADDITIONAL INFORMATION
Please see the screenshots
Comment 1 Michel Le Bihan 2024-01-16 12:08:53 UTC
Created attachment 164944 [details]
Screenshot1
Comment 2 Michel Le Bihan 2024-01-16 12:09:31 UTC
Created attachment 164945 [details]
Screenshot2
Comment 3 Nate Graham 2024-01-17 00:08:34 UTC
At 225% scale, I can't reproduce any text artifacts in Kickoff, but I can reproduce the issue for the letters "i" and "l" in Discover's sidebar. 

Discover is using qqc2-desktop-style while Plasma is using the Plasma style; the common denominator is QtQuick Label itself, so the issue might be in there.
Comment 4 Nate Graham 2024-01-17 00:09:37 UTC
Created attachment 164964 [details]
In Discover

Now that I zoom in on that screenshot, I see the letter "c" in "All Applications" exhibits the issue as well.
Comment 5 Nate Graham 2024-01-18 15:49:01 UTC
Created attachment 165011 [details]
In NeoChat

Found some more examples in NeoChat today. Still 225% scale.
Comment 6 Nate Graham 2024-01-18 17:58:28 UTC
Created attachment 165015 [details]
Yikes in NeoChat

Found another in NeoChat that downright qualifies as software gore. This is at 110% scale on a 1080p screen.
Comment 7 Nate Graham 2024-01-18 19:23:36 UTC
In that screenshot, the top message exhibits the issue, and the bottom message doesn't. However that's only because I selected the text in the bottom message. Before I selected it, it looked like in the top message. This shows that it doesn't have to always be that way, even on this challenging scale factor and screen resolution combination.
Comment 8 Michel Le Bihan 2024-01-22 10:48:31 UTC
Isn't there a subsurface alignment issue in KWin? I run the subsurface test client mentioned in https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/143#note_1343171 and there is clearly a misalignment. I run the same test client in Mutter with fractional scaling and it looked fine. It seems that it was corrected in Mutter in https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726.
Comment 9 Michel Le Bihan 2024-01-22 10:49:54 UTC
Created attachment 165120 [details]
aligned-scale-test-100%
Comment 10 Michel Le Bihan 2024-01-22 10:50:16 UTC
Created attachment 165121 [details]
aligned-scale-test-125%
Comment 11 Michel Le Bihan 2024-01-22 10:50:32 UTC
Created attachment 165122 [details]
aligned-scale-test-150%
Comment 12 Michel Le Bihan 2024-01-22 10:50:47 UTC
Created attachment 165123 [details]
aligned-scale-test-175%
Comment 13 David Edmundson 2024-01-22 15:54:56 UTC
>Isn't there a subsurface alignment issue in KWin?

Even if there was, the examples above aren't used subsurfaces
Comment 14 S 2024-03-06 16:33:16 UTC
I experience the same issue on 6.0.1, with deformed and misplaced letters around most of the Plasma UI and System Settings, at 150% scaling. Looks like there are no issues in Widgets apps, GTK apps and Firefox. Most icons are also either blurry or pixelated, and even some UI elements. Some icons "unblur" for a short period of time when hovering over them with the cursor.
Comment 15 Marco Martin 2024-03-07 15:23:33 UTC
*** Bug 482720 has been marked as a duplicate of this bug. ***
Comment 16 Alexey 2024-03-07 15:27:14 UTC
Created attachment 166602 [details]
1920x1080 125% (System settings dialog)
Comment 17 Alexey 2024-03-07 15:27:38 UTC
Created attachment 166603 [details]
1920x1080 125% (System settings dialog 2)
Comment 18 Alexey 2024-03-07 15:32:44 UTC
(In reply to Marco Martin from comment #15)
> *** Bug 482720 has been marked as a duplicate of this bug. ***

Bug 482722 may also be related to this issue but the artifacts described there achieved through certain actions.
Comment 19 Nate Graham 2024-03-07 21:38:31 UTC
*** Bug 482633 has been marked as a duplicate of this bug. ***
Comment 20 Nate Graham 2024-03-07 22:12:05 UTC
*** Bug 482746 has been marked as a duplicate of this bug. ***
Comment 21 Nate Graham 2024-03-10 20:56:04 UTC
*** Bug 482928 has been marked as a duplicate of this bug. ***
Comment 22 Nate Graham 2024-03-13 18:00:58 UTC
*** Bug 481233 has been marked as a duplicate of this bug. ***
Comment 23 Nate Graham 2024-03-13 18:01:51 UTC
Apparently setting QT_SCALE_FACTOR_ROUNDING_POLICY=RoundPreferFloor in the environment works around this.
Comment 24 Dāvis 2024-03-13 19:32:37 UTC
(In reply to Nate Graham from comment #23)
> Apparently setting QT_SCALE_FACTOR_ROUNDING_POLICY=RoundPreferFloor in the
> environment works around this.

Indeed, that makes it look WAY better.
Comment 25 David Edmundson 2024-03-14 14:11:38 UTC
*** Bug 483112 has been marked as a duplicate of this bug. ***
Comment 26 NW 2024-03-16 17:09:14 UTC
Qt 6 apparently sets the "QT_SCALE_FACTOR_ROUNDING_POLICY" environment variable to "PassThrough" by default, according to:

https://doc.qt.io/qt-6/highdpi.html#environment-variable-reference

And manually changing the "QT_SCALE_FACTOR_ROUNDING_POLICY" environment variable to "RoundPreferFloor" indeed seems to fix the issue:

https://doc.qt.io/qt-6/qt.html#HighDpiScaleFactorRoundingPolicy-enum

Can "RoundPreferFloor" be made the new default for KDE Plasma and/or can a setting for it be added to the KDE Plasma GUI system settings?
Comment 27 NW 2024-03-16 18:10:25 UTC
PS:

Actually any value, other than the Qt 6 default value "PassThrough", seems to fix the issue:

https://doc.qt.io/qt-6/qt.html#HighDpiScaleFactorRoundingPolicy-enum

Because the "Round", "Ceil" and "Floor" settings also seem to solve the issue (not just the "RoundPreferFloor" setting).

According to the documentation, "Round" was the default setting for Qt 5 and "PassThrough" is the default setting for Qt 6:

https://doc.qt.io/qt-6/highdpi.html#environment-variable-reference

And only the "PassThrough" setting seems to cause the issue.

The documentation also seems to suggest that using any of the non-default settings ("Round", "Ceil", "Floor", "RoundPreferFloor") would round fractional values either up or down to the next integer value:

https://doc.qt.io/qt-6/qguiapplication.html#setHighDpiScaleFactorRoundingPolicy

But the size of the items on the screen do not seem to change at first glance. The only effect that those non-default settings seem to have is that the font rendering issue is fixed when using them.
Comment 28 drokergeek 2024-03-19 07:32:38 UTC
For me, I get this issue under 150% scaling and not under 125% scaling (neither i get https://bugs.kde.org/show_bug.cgi?id=459373 under 125%)

Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.1-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7840U w/ Radeon 780M Graphics
Memory: 30.5 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: Framework
Product Name: Laptop 13 (AMD Ryzen 7040Series)
System Version: A7
Comment 29 Cameron Smith 2024-04-11 12:37:01 UTC
I made a post a few days back regarding this bug (https://discuss.kde.org/t/kde-6-upgrade-broke-fonts-in-wayland/13254) and am delighted to report that setting the "QT_SCALE_FACTOR_ROUNDING_POLICY" environment variable to "RoundPreferFloor" indeed seems to fix all issues I had.

Hopefully this can be resolved in a release soon, as it seems (to me at least) to be a straightforward fix. I've got no idea what implications setting this variable might have on niche situations elsewhere in KDE, but so far all good on my end. Thanks Nate for the solution!

My setup:
Thinkpad T480s
Arch linux
KDE 6.0.3
Wayland session (ofc)
Comment 30 Vasily Khoruzhick 2024-04-16 22:27:48 UTC
*** Bug 485647 has been marked as a duplicate of this bug. ***
Comment 31 dft 2024-04-28 15:10:24 UTC
Created attachment 168973 [details]
1440p@125% - Normal Settings Window
Comment 32 Lucas 2024-05-13 18:10:21 UTC
Created attachment 169453 [details]
Kmail horrible font @ 125% 3440x1440

My contribution. Hope this is resolved soon.
Comment 33 Nate Graham 2024-06-11 23:00:43 UTC
*** Bug 487899 has been marked as a duplicate of this bug. ***
Comment 34 Nate Graham 2024-06-17 17:02:45 UTC
*** Bug 488623 has been marked as a duplicate of this bug. ***
Comment 35 gilles 2024-06-20 07:30:33 UTC
Created attachment 170663 [details]
Screenshot of Konsole toolbar on X11, 150% fractional scaling, Qt rounding policy set

I can confirm that setting QT_SCALE_FACTOR_ROUNDING_POLICY to RoundPreferFloor indeed fixes the bad glyph rendering, however it also seems to disable fractional scaling on X11 for all graphical elements (fonts seem to still be properly scaled though ?), for instances icons are either scaled to 2x or to 1x depending on the ratio.

In the attached screenshot, the icons are too small compared to the text with 150% scaling factor. With scaling factors <=150%, it also makes plasma panels to be sized at 1x (but with text scaled at 150% !).
Comment 36 Nate Graham 2024-06-20 13:31:29 UTC
This is a Qt issue. Multiple patches have gone in recently that make this better:
- https://github.com/qt/qtbase/commit/e7ddd490cf44ecd1c59b3798294ed2812fc5a940 (in 6.7.1)
- https://github.com/qt/qtbase/commit/a5953d20e27ab73774058dd06ac514f9310a41e8 (in 6.8.0)

...But none fully fix it. 

Of note, this specific glitch only seems to affect QML labels using Text.NativeRendering. Switching to Text.QtRendering makes the issue go away — at the cost of introducing two new ones: blurrier text and excessive boldness at the topr or bottoms of all characters on a single line.

Work and investigation are ongoing.
Comment 37 Nate Graham 2024-06-20 14:10:56 UTC
Minimum reproducible case for me:

import QtQuick

ListView {
    width: 200
    height: 400

    model: 50

    delegate: Text {
        text: "I might be misaligned"
        renderType: Text.NativeRendering
    }
}

Scroll on that while it's located on a screen with fractional scaling, and the issue will quickly show up.
Comment 38 derek 2024-06-23 15:43:24 UTC Comment hidden (spam)
Comment 39 Nate Graham 2024-06-25 15:38:48 UTC
*** Bug 489101 has been marked as a duplicate of this bug. ***
Comment 40 Nate Graham 2024-06-25 15:39:42 UTC Comment hidden (spam)
Comment 41 Pavel Dobiáš 2024-06-27 13:31:56 UTC
Created attachment 171084 [details]
System Settings - Overview (Applications) 1920x1080@125%

Idk if this is related exactly to this specific bug, but I have 125% fractional scaling set on my 1080p display and my System Monitor Applications section in Overview looks terrible.
Comment 42 postix 2024-07-20 12:29:57 UTC
Created attachment 171822 [details]
Screenshot: SystemSettings::Sound volume (1.25 scaling, Plasma 6.1.2 with Qt6.7.2 on F40)
Comment 43 postix 2024-07-20 12:40:04 UTC
*** Bug 489076 has been marked as a duplicate of this bug. ***
Comment 44 postix 2024-07-20 12:40:09 UTC
By Andreas G in bug #489076

> This is a bug in qtwebengine:
> https://bugreports.qt.io/browse/QTBUG-113574
> 
> You can work around it by setting the environment variable:
> QT_SCALE_FACTOR_ROUNDING_POLICY=RoundPreferFloor
> https://userbase.kde.org/Session_Environment_Variables
> 
> Or you just wait for qt 6.8 to get released and deployed. It will be fixed
> in the next version.

Can anyone confirm that this also fixes their issue here? It does so at least for me in (Comment 42).
Comment 45 cwo 2024-07-30 12:32:11 UTC
*** Bug 486039 has been marked as a duplicate of this bug. ***
Comment 46 cwo 2024-08-04 23:38:06 UTC
*** Bug 491258 has been marked as a duplicate of this bug. ***
Comment 47 dofficialgman 2024-08-14 17:47:46 UTC
Created attachment 172622 [details]
bad text alignment on plasma 6.1.3 wayland (4K 150%)

I believe I am also experiencing this issue.
Comment 48 dofficialgman 2024-08-14 17:50:50 UTC
(In reply to postix from comment #44)
> By Andreas G in bug #489076
> 
> > This is a bug in qtwebengine:
> > https://bugreports.qt.io/browse/QTBUG-113574
> > 
> > You can work around it by setting the environment variable:
> > QT_SCALE_FACTOR_ROUNDING_POLICY=RoundPreferFloor
> > https://userbase.kde.org/Session_Environment_Variables
> > 
> > Or you just wait for qt 6.8 to get released and deployed. It will be fixed
> > in the next version.
> 
> Can anyone confirm that this also fixes their issue here? It does so at
> least for me in (Comment 42).

using the environment variable works around the issue I posted in the previous comment (plasma 6.1.3 QT 6.7.2 KDE Neon 24.04)
Comment 49 dofficialgman 2024-08-14 18:21:25 UTC
(In reply to Michel Le Bihan from comment #8)
> Isn't there a subsurface alignment issue in KWin? I run the subsurface test
> client mentioned in
> https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/
> 143#note_1343171 and there is clearly a misalignment. I run the same test
> client in Mutter with fractional scaling and it looked fine. It seems that
> it was corrected in Mutter in
> https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726.

That test shows there is subsurface alignment issues. Can you open another bug report for that as its unrelated to this one? I have run the tests myself and confirmed your results.
Comment 50 dofficialgman 2024-08-14 18:31:24 UTC
(In reply to dofficialgman from comment #49)
> That test shows there is subsurface alignment issues. Can you open another
> bug report for that as its unrelated to this one? I have run the tests
> myself and confirmed your results.

I went ahead and opened a bug for this issue.
Comment 51 cwo 2024-09-15 20:03:27 UTC
*** Bug 489845 has been marked as a duplicate of this bug. ***
Comment 52 gilles 2024-10-10 20:32:57 UTC
Created attachment 174652 [details]
Minimal reproducing case with Qt 6.8.0

I've got some bad news. This issue is still present in with Qt 6.8.0, and can still be easily reproduced with the minimal reproducing case in https://bugs.kde.org/show_bug.cgi?id=479891#c37.

❯ qml6 --version      
Qml Runtime 6.8.0
Comment 53 Ilya Fedin 2024-10-29 05:35:16 UTC
Looks like the bug happens because this check misbehaves on Wayland: https://invent.kde.org/frameworks/qqc2-desktop-style/-/blob/master/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp#L53-59

On X11, QScreen properly reports fractional scale factors while on Wayland they report only integer scale factors so qGuiApp->devicePixelRatio() reports the integer one, too. And the fractional one could be retrieved only from QWindow.

Also, the link in the code seem to be quite outdated, the bug is still here but tracked by https://bugreports.qt.io/browse/QTBUG-122830 now.
Comment 55 Nate Graham 2024-10-29 19:57:52 UTC
Wanna submit a patch?
Comment 56 Ilya Fedin 2024-10-30 03:49:02 UTC
I submitted it already, as a part of a different work, to qtwayland. Sadly, David Edmundson rejected the idea.

https://codereview.qt-project.org/c/qt/qtwayland/+/590173 (most discussion including -1 is in the qtbase patch, click on the topic link)

It seems David himself also had a similar patch but abandoned it, too.

https://codereview.qt-project.org/c/qt/qtwayland/+/563344
Comment 57 David Edmundson 2024-10-30 14:54:23 UTC
>It seems David himself also had a similar patch but abandoned it, too.

At least I'm consistent.

I even tried pushing it upstream too. What put me off was the chromium developers showing me their version and the need for different rounding in each desktop. 

Experience so far seems to suggest re-scaling from 200 pixels to 150 pixels is always ok. Not great, not terrible.
Re-scaling from 151 pixels to 150 pixels can look absolutely trash. So if we're going to do it, we need the value spot on.
Comment 58 Ilya Fedin 2024-10-30 15:31:59 UTC
Those patches provide the right values to the user-facing APIs such as qApp->devicePixelRatio() so the code like the one in qqc2-desjtoo-styke works correctly, they don't add any rescaling.
Comment 59 Ilya Fedin 2024-10-30 15:38:30 UTC
I also wonder whether int(devicePixelRatio) == devicePixelRatio check has to be exactly that? The next integer scaling factor is 2x and I'm really doubt that any difference between QtRendering and NativeRendering is visible with such factor. qFuzzyCompare(qApp->devicePixelRatio(), qreal(1.0)) would make it work on Wayland and will also be a better fit for multiscreen setups (such as when the screen with highest DPR has integer DPR but there's still a screen with fractional DPR)
Comment 60 Ilya Fedin 2024-11-02 14:52:55 UTC
Nate, what do you think about changing the condition to qFuzzyCompare(qApp->devicePixelRatio(), qreal(1.0)), i.e. using Qt text rendering whenever scaling is enabled rather than only when the screen with highest scaling factor has fractional one? That would fix the issue and any difference in rendering is unlikely to be visible with 2x and higher anyway.
Comment 61 Nate Graham 2024-11-04 17:39:50 UTC
I don't have a technical opinion on the matter. David, what do you think?
Comment 62 David Edmundson 2024-11-06 17:34:27 UTC
>Nate, what do you think about changing the condition to qFuzzyCompare(qApp->devicePixelRatio(), qreal(1.0))

Totally makes sense. Negative part is it's not dynamic. I made a MR for an even more aggressive version and just always enable it. We'll see how that goes then if that gets pushback we can do that version.
Comment 63 Vasily Khoruzhick 2024-11-06 18:06:04 UTC
Hey folks,

This bug has been opened since January, and there is a known workaround (setting QT_SCALE_FACTOR_ROUNDING_POLICY=RoundPreferFloor).

I hope I don't offend anyone and I don't intend to hurt or blame anyone, but I really wonder is there a good reason not to apply it at plasma level rather than asking users to set it? I understand that it's free software and developers are working on it in their spare time, but if there is not enough resources to fix the underlying issue, why not to apply a workaround?
Comment 64 Ilya Fedin 2024-11-06 18:11:17 UTC
The rounding policy workaround just disables fractional scaling (you get apps downscaled from the next integer scale factor). The Qt text rendering workaround doesn't disable fractional scaling at least, just changes the text rendering method...
Comment 65 Vasily Khoruzhick 2024-11-06 18:42:31 UTC
(In reply to Ilya Fedin from comment #64)
> The rounding policy workaround just disables fractional scaling (you get
> apps downscaled from the next integer scale factor). The Qt text rendering
> workaround doesn't disable fractional scaling at least, just changes the
> text rendering method...

As an user I don't really care if it's downscaled from the next integer scale factor or not, I care if it's crisp or not. What I'm asking is why we don't have plasma-level workaround while we don't have a proper fix.
Comment 66 gilles 2024-11-06 18:43:29 UTC
Hi,

Unfortunately, it's not a valid workaround, neither on X11 nor Wayland (and this bug is equally reproducible on both environments with the reproducer in https://bugs.kde.org/show_bug.cgi?id=479891#c37 as long as fractional scaling is enabled):

- On X11, it screws up the relative scaling of images and text, as I explained in https://bugs.kde.org/show_bug.cgi?id=479891#c35 for instance

- On Wayland, it completely disables native fractional rendering, instead relying on the compositor, as explained here https://bugreports.qt.io/browse/QTBUG-113574. As a result, fonts gets blurry, which depending on personal tolerance to bad font rendering, is perceived from invisible to insufferable. In particular, it makes CJK characters really hard to read at small font sizes.
Comment 67 Ilya Fedin 2024-11-06 18:47:18 UTC
> What I'm asking is why we don't have plasma-level workaround while we don't have a proper fix.

It's already present (as I linked previously), it just doesn't work if you use Wayland.
Comment 68 Bug Janitor Service 2024-11-07 12:21:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/429
Comment 69 Nate Graham 2024-11-08 21:58:34 UTC
*** Bug 494217 has been marked as a duplicate of this bug. ***
Comment 70 gilles 2024-11-09 15:07:33 UTC
For Arch users, I've published qqc2-desktop-style alternative which always forces QtTextRendering, based on David's MR https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/429, as it completely solves this issues for me with 150% fractional scaling:

https://aur.archlinux.org/packages/qqc2-desktop-style-fractional
Comment 71 Luis 2024-11-14 23:15:47 UTC
(In reply to gilles from comment #70)
> For Arch users, I've published qqc2-desktop-style alternative which always
> forces QtTextRendering, based on David's MR
> https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/429,
> as it completely solves this issues for me with 150% fractional scaling:
> 
> https://aur.archlinux.org/packages/qqc2-desktop-style-fractional
i've applied that patch to my nixOS system, and while it does solve text rendering mostly, I still have text and icons moving around a bit when highlighting stuff on Dolphin/Dolphin as file picker, and sometimes I get leftover thin horizontal lines on Konsole.
Comment 72 Luis 2024-11-14 23:36:55 UTC
(In reply to Luis from comment #71)
> (In reply to gilles from comment #70)
> > For Arch users, I've published qqc2-desktop-style alternative which always
> > forces QtTextRendering, based on David's MR
> > https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/429,
> > as it completely solves this issues for me with 150% fractional scaling:
> > 
> > https://aur.archlinux.org/packages/qqc2-desktop-style-fractional
> i've applied that patch to my nixOS system, and while it does solve text
> rendering mostly, I still have text and icons moving around a bit when
> highlighting stuff on Dolphin/Dolphin as file picker, and sometimes I get
> leftover thin horizontal lines on Konsole.

Actually, it's just on the Dolphin file picker. Normal Dolphin is fine.
Comment 73 Luis 2024-11-14 23:49:02 UTC
(In reply to Luis from comment #72)
> (In reply to Luis from comment #71)
> > (In reply to gilles from comment #70)
> > > For Arch users, I've published qqc2-desktop-style alternative which always
> > > forces QtTextRendering, based on David's MR
> > > https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/429,
> > > as it completely solves this issues for me with 150% fractional scaling:
> > > 
> > > https://aur.archlinux.org/packages/qqc2-desktop-style-fractional
> > i've applied that patch to my nixOS system, and while it does solve text
> > rendering mostly, I still have text and icons moving around a bit when
> > highlighting stuff on Dolphin/Dolphin as file picker, and sometimes I get
> > leftover thin horizontal lines on Konsole.
> 
> Actually, it's just on the Dolphin file picker. Normal Dolphin is fine.

Happens on System Settings still...
Comment 74 Ilya Fedin 2024-11-14 23:59:58 UTC
> Actually, it's just on the Dolphin file picker. Normal Dolphin is fine.

If you mean file dialog, it has nothing to do with dolphin. It's a part of plasma-integration or xdg-desktop-portal-kde (yes, there are two of them).
Comment 75 Ilya Fedin 2024-11-15 00:22:26 UTC
> Happens on System Settings still...

Perhaps you didn't really applied it? That likely not as trivial as on other distros on NixOS.
Comment 76 Luis 2024-11-15 01:02:44 UTC
(In reply to Ilya Fedin from comment #75)
> > Happens on System Settings still...
> 
> Perhaps you didn't really applied it? That likely not as trivial as on other
> distros on NixOS.

I used the following overlay
```
kdePackages = super.kdePackages // {
				qqc2-desktop-style = super.kdePackages.qqc2-desktop-style.override (old: {
					mkKdeDerivation = args: super.kdePackages.mkKdeDerivation ( args // {
						patches = [
						# ./patches/force_qttextrendering.patch
						./patches/force_nativetextrendering.patch
						];
					});
				});
			};
```

force_qttextrendering.patch being gilles' patch from the AUR, and force_nativetextrendering.patch being this https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/429/diffs#2a3d10f43f861a11d8c4e155373c59e7f24179c1_61_59.

I do think it did work, because the package did compile, before it compiled properly, it complained about the file being missing, which then I corrected, and it did recompile when I changed patches, so I assume it did work.
Comment 77 Luis 2024-11-15 01:03:34 UTC
(In reply to Ilya Fedin from comment #74)
> > Actually, it's just on the Dolphin file picker. Normal Dolphin is fine.
> 
> If you mean file dialog, it has nothing to do with dolphin. It's a part of
> plasma-integration or xdg-desktop-portal-kde (yes, there are two of them).

Huh. I need to find which is which then, I need to ask for a feature to be added to it.
Comment 78 Reilly Brogan 2024-11-15 01:05:43 UTC
I applied the patch to the appropriate package on Solus and I haven't really noticed any of the previous glyph rendering issues. I looked through systemsettings and while I'm not really sure which KCMs are QML-based and which aren't I didn't notice any rendering issues. So my guess is that the patch is incorrectly applied (but if not please provide which KCM is having issues and I'll try to reproduce it).
Comment 79 Luis 2024-11-15 01:12:22 UTC
(In reply to Reilly Brogan from comment #78)
> I applied the patch to the appropriate package on Solus and I haven't really
> noticed any of the previous glyph rendering issues. I looked through
> systemsettings and while I'm not really sure which KCMs are QML-based and
> which aren't I didn't notice any rendering issues. So my guess is that the
> patch is incorrectly applied (but if not please provide which KCM is having
> issues and I'll try to reproduce it).

I just scrolled up and down systemsettings multiple times and got the issues :/, this is awkward, then.
Comment 80 Ilya Fedin 2024-11-15 01:39:39 UTC
> I used the following overlay

Shouldn't it be like that?
```
kdePackages = super.kdePackages // {
				qqc2-desktop-style = super.kdePackages.qqc2-desktop-style.overrideAttrs (old: {
					patches = [
						./patches/force_qttextrendering.patch
					];
				});
			};
```
Also, I noticed you had force_nativetextrendering instead of force_qttextrendering? While native text rendering is exactly the broken?
Comment 81 Luis 2024-11-15 01:53:58 UTC
Created attachment 175833 [details]
overlay applied, text still messy
Comment 82 Luis 2024-11-15 01:55:07 UTC
(In reply to Ilya Fedin from comment #80)
> > I used the following overlay
> 
> Shouldn't it be like that?
> ```
> kdePackages = super.kdePackages // {
> 				qqc2-desktop-style = super.kdePackages.qqc2-desktop-style.overrideAttrs
> (old: {
> 					patches = [
> 						./patches/force_qttextrendering.patch
> 					];
> 				});
> 			};
> ```
> Also, I noticed you had force_nativetextrendering instead of
> force_qttextrendering? While native text rendering is exactly the broken?

your overlay works just like mine, no recompile, and I still have the messy text :/. I'm on 125% scale, 1920x1200 screen.
Comment 83 Luis 2024-11-15 01:56:15 UTC
(In reply to Luis from comment #82)
> (In reply to Ilya Fedin from comment #80)
> > > I used the following overlay
> > 
> > Shouldn't it be like that?
> > ```
> > kdePackages = super.kdePackages // {
> > 				qqc2-desktop-style = super.kdePackages.qqc2-desktop-style.overrideAttrs
> > (old: {
> > 					patches = [
> > 						./patches/force_qttextrendering.patch
> > 					];
> > 				});
> > 			};
> > ```
> > Also, I noticed you had force_nativetextrendering instead of
> > force_qttextrendering? While native text rendering is exactly the broken?
> 
> your overlay works just like mine, no recompile, and I still have the messy
> text :/. I'm on 125% scale, 1920x1200 screen.

and naming aside, i made a mistake writing the other patch, indeed it did nothing, was supposed to have your changes on the 429 MR.
Comment 84 Ilya Fedin 2024-11-15 02:44:44 UTC
Yeah, most likely the qqc2-desktop-style dependency gets specified in a way that doesn't involves accessing the attribute so overay doesn't work. I.e. it's likely you have to specify the overridden package to every package using it. system.replaceDependencies.replacements is likely the easiest way to get the patched version actually used by everything.
Comment 85 David Edmundson 2024-11-22 21:57:04 UTC
Git commit e82957f5e6fc72e446239e2ee5139b93d3ceac85 by David Edmundson.
Committed on 22/11/2024 at 21:57.
Pushed by davidedmundson into branch 'master'.

Use Qt text rendering when high DPI scaling

It is known that native rendering performs badly with scaling and an
existing workaround is in place.

The current check does not work on Wayland that has per-window rather
than per-screen scaling. Given Qt changes hinting preferences when any
scaling is used anyway, we may as well commit to using the non-native
rendering throughout.

For QtQuick the Qt renderer is more performant, handles transformations
better and avoids this issue. Given the results look basically
identical, we can simplify the existing code.

M  +9    -8    kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp

https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/e82957f5e6fc72e446239e2ee5139b93d3ceac85
Comment 86 James W 2024-11-23 19:01:57 UTC
*** Bug 496579 has been marked as a duplicate of this bug. ***
Comment 87 GoldBarb 2024-11-23 22:20:48 UTC
(In reply to David Edmundson from comment #85)
> Git commit e82957f5e6fc72e446239e2ee5139b93d3ceac85 by David Edmundson.
> Committed on 22/11/2024 at 21:57.
> Pushed by davidedmundson into branch 'master'.
> 
> Use Qt text rendering when high DPI scaling
> 
> It is known that native rendering performs badly with scaling and an
> existing workaround is in place.
> 
> The current check does not work on Wayland that has per-window rather
> than per-screen scaling. Given Qt changes hinting preferences when any
> scaling is used anyway, we may as well commit to using the non-native
> rendering throughout.
> 
> For QtQuick the Qt renderer is more performant, handles transformations
> better and avoids this issue. Given the results look basically
> identical, we can simplify the existing code.
> 
> M  +9    -8    kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp
> 
> https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/
> e82957f5e6fc72e446239e2ee5139b93d3ceac85

Does the environment variable: QT_SCALE_FACTOR_ROUNDING_POLICY=RoundPreferFloor
Still need to be set ?
Comment 88 Nate Graham 2024-11-25 15:14:51 UTC
No, that should be unset now.
Comment 89 Arjen Hiemstra 2024-11-27 09:55:04 UTC
*** Bug 496726 has been marked as a duplicate of this bug. ***
Comment 90 Robby Engelmann 2024-11-27 10:29:20 UTC
Created attachment 176164 [details]
Dolphins preview
Comment 91 Robby Engelmann 2024-11-27 10:29:34 UTC
There is there some mis-rendering in dolphins preview pane (see attachment)
Comment 92 Nate Graham 2024-11-27 13:49:37 UTC
That's something else. This bug report is about QML text in desktop apps. That text is rendered by the thumbnailer plugins, which isn't QML.
Comment 93 Robby Engelmann 2024-11-27 14:57:20 UTC
should I open a new report or is there already one?
Comment 94 Nate Graham 2024-11-27 16:32:29 UTC
New one please.
Comment 95 gilles 2024-11-27 22:51:27 UTC
(In reply to Robby Engelmann from comment #91)
> There is there some mis-rendering in dolphins preview pane (see attachment)

This bad image scaling-related issue is different and is already well known in various KDE apps:
- Kolourpaint https://bugs.kde.org/show_bug.cgi?id=436615
- Kontact https://bugs.kde.org/show_bug.cgi?id=482128
- Kmail https://bugs.kde.org/show_bug.cgi?id=488324
- It is also visible in System Settings > Text & Fonts > Font Management