Bug 391691

Summary: Logout overlay has blurry pixellated text with non-integer scale factors
Product: [Plasma] plasmashell Reporter: Nate Graham <nate>
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, linuxhippy, plasma-bugs
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Blurry pixellated logout overlay

Description Nate Graham 2018-03-11 00:42:13 UTC
When a systemwide scale factor is set in System Settings > Display & Monitor > Displays > Scale, the logout overlay has blurry pixellated text. I checked for QQC1 controls, and there's only one; the escape key handler: 

Controls.Action {
        onTriggered: root.cancelRequested()
        shortcut: "Escape"
    }

Is it possible that this one thing is causing the blurriness, and that porting it to QQC2 will resolve the issue?
Comment 1 Nate Graham 2018-03-11 00:43:48 UTC
Created attachment 111307 [details]
Blurry pixellated logout overlay
Comment 2 David Edmundson 2018-03-11 00:56:25 UTC
> there's only one

There are many. Follow the components import.

>and that porting it to QQC2 will resolve the issue?

It will make no difference.
Only relevant thing is Text render type. Text isn't part of QQC at all, but some components will use Text and thus could set it. Plasma controls (for 1 or 2) do not.

There are 3 options:
 - Disable Qt scaling on the lock screen, as Plasma does it's own scaling anyway so it makes no difference (there's a discard phab patch from me about a year ago)

 - Change the Text render type in Plasma text items  

renderType: Window.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
(as per qqc2-desktop-style )

 - Wait for relevant Qt fix
Comment 3 Nate Graham 2018-03-11 01:05:21 UTC
Thanks David. So forcing the use of Text.NativeRendering at non-integer scale factors will resolve it? What's the downside to this?
Comment 4 David Edmundson 2018-03-11 15:49:47 UTC
Other way round.
Disabling native rendering "fixes" it. 

Downside is you don't get native rendering. (with correct subpixel hinting and whatever other native things you might have)

To me it looks the same, but some people are weirdly uptight about fonts.
Comment 5 Nate Graham 2018-03-11 16:19:36 UTC
I'm a person who's uptight about fonts, but I'm also realistic: fonts without sub-pixel anti-aliasing are vastly better than fonts that are blurry and pixellated! I often use a non-integer scale factor (1.1x) and fonts look fantastic to me. Those "tricks" are more necessary for non-HiDPi use cases anyway. If we lose sub-pixel anti-aliasing, but gain usable, pretty-enough fonts at non-integer scale factors, that seems like a huge win to me. It'd be one step back, and like 20 steps forward IMHO.

And do we (or Qt) have a bug report on Text.NativeRendering being broken at non-integer scale factors?
Comment 6 Nate Graham 2018-03-11 19:55:41 UTC
>  - Change the Text render type in Plasma text items  

I've submitted a patch that does that: https://phabricator.kde.org/D11244. Also...

> Downside is you don't get native rendering. (with correct subpixel hinting and whatever other native things you might have)

In fact, with QtRendering, we do still get sub-pixel anti-aliasing! Zoom in on some text in the  "After" screenshot in my patch and see for yourself. I cannot detect any issues whatsoever resulting from switching the rendering backend.
Comment 7 Nate Graham 2018-03-16 22:27:16 UTC
Git commit a21bc11fe11651f6d211489ebfc8435cef877194 by Nathaniel Graham.
Committed on 16/03/2018 at 22:26.
Pushed by ngraham into branch 'master'.

Fix text scaling with non-integer scale factors when PLASMA_USE_QT_SCALING=1 is set

Summary:
When `PLASMA_USE_QT_SCALING=1` is set, Plasma uses native Qt scaling. This works fine for integer scale factors, and fixes a lot of bugs (see [[https://bugs.kde.org/show_bug.cgi?id=356446|Bug 356446]]) but it introduces a new one: with non-integer scale factors, text becomes blurry and pixellated because of a bug in `Text.NativeRendering`: https://bugreports.qt.io/browse/QTBUG-67007

QQC2-desktop-style forces the use of `Text.QtRendering` rendering for non-integer scale factors, successfully working around the problem. But PlasmaComponents QML objects don't implement the same workaround, so we see the issue in Plasma. This patch fixes that, and gets us one step closer to being able to use Qt scaling in Plasmashell.

There is no effect when `PLASMA_USE_QT_SCALING=1` is not being used.

FIXED-IN 5.13
Related: bug 384031, bug 386216, bug 391695, bug 391694, bug 385547, bug 391692, bug 356446

Test Plan:
Before: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks awful:
{F5749797}

After: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks amazing!
{F5749798}

Note that we still get sub-pixel anti-aliasing and good kerning. There appear to be no layout regressions.

Without both `PLASMA_USE_QT_SCALING=1` and a non-integer scale factor set, there is no visual change compared to the status quo.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: mart, broulik, #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D11244

M  +4    -2    examples/applets/testtheme/contents/ui/FontGizmo.qml
M  +5    -1    src/declarativeimports/plasmacomponents/qml/Label.qml
M  +5    -1    src/declarativeimports/plasmacomponents/qml/private/DualStateButton.qml
M  +4    -0    src/declarativeimports/plasmacomponents3/ComboBox.qml
M  +5    -1    src/declarativeimports/plasmacomponents3/Label.qml
M  +5    -1    src/declarativeimports/plasmacomponents3/TextArea.qml
M  +5    -1    src/declarativeimports/plasmacomponents3/TextField.qml
M  +5    -0    src/declarativeimports/plasmastyle/ComboBoxStyle.qml
M  +4    -1    src/declarativeimports/plasmastyle/SpinBoxStyle.qml
M  +4    -1    src/declarativeimports/plasmastyle/TextAreaStyle.qml
M  +4    -1    src/declarativeimports/plasmastyle/TextFieldStyle.qml

https://commits.kde.org/plasma-framework/a21bc11fe11651f6d211489ebfc8435cef877194
Comment 8 David Edmundson 2018-05-21 08:36:45 UTC
*** Bug 394465 has been marked as a duplicate of this bug. ***