Bug 416140 - On first boot, sub-pixel font rendering shows "RGB" in the KCM, but is not actually applied until you change it to something else and then back once
Summary: On first boot, sub-pixel font rendering shows "RGB" in the KCM, but is not ac...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_fonts (show other bugs)
Version: 5.25.5
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords: regression
: 415471 415707 431197 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-01-11 21:47 UTC by Tony
Modified: 2022-09-23 22:57 UTC (History)
18 users (show)

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


Attachments
Screenshots before (20.51 KB, image/png)
2020-01-13 10:05 UTC, Tony
Details
Screenshots after (20.25 KB, image/png)
2020-01-13 10:06 UTC, Tony
Details
Local fonts settings. (1.91 KB, application/xml)
2020-05-06 16:44 UTC, Tony
Details
Screenshots_unstable_before (237.02 KB, image/png)
2020-05-06 16:45 UTC, Tony
Details
Screenshots_unstable_after (357.90 KB, image/png)
2020-05-06 16:45 UTC, Tony
Details
Screenshots before link on neon-user (186.37 KB, image/png)
2020-05-24 21:17 UTC, Tony
Details
Screenshots after link on neon-user (736.33 KB, image/png)
2020-05-24 21:18 UTC, Tony
Details
Text file opened in Okular (58.65 KB, image/png)
2021-02-15 11:38 UTC, Vladimir Yerilov
Details
KInfoCenter's "Energy" section (85.41 KB, image/png)
2021-02-15 11:41 UTC, Vladimir Yerilov
Details
Test using Plasma 5.22.1 showing full font hinting is not applied. (95.82 KB, image/jpeg)
2021-06-26 03:23 UTC, PJSingh5000
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tony 2020-01-11 21:47:00 UTC
SUMMARY

Hello, 
I find default fonts in Neon to be washed out, not clear. 
Even if sub-pixel rendering is enabled, there's no trace of this setting in ~/.config/fontconfig/fonts.conf
If i create a symlink in /etc/fonts/conf.d to /etc/fonts/conf.avail/10-sub-pixel-rgb.conf, fonts improve a lot.

STEPS TO REPRODUCE

Create a symlink to /etc/fonts/conf.avail/10-sub-pixel-rgb.conf in /etc/fonts/conf.d/

OBSERVED RESULT

Fonts are definitely more legible, crisp and enjoyable. 

EXPECTED RESULT

I expect this setting to work by default, being enabled in fonts settings, either enabling it system-wide as i did, either per-user in fonts.conf.
Thanks.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: KDE Neon
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.65
Qt Version: 5.13.2
Comment 1 Nate Graham 2020-01-12 23:52:33 UTC
Could you attach screenshots showing the problem before you apply the fix, and how it looks like afterwards?
Comment 2 Harald Sitter 2020-01-13 09:42:14 UTC
Nate, isn't this a Plasma issue? From the plasma side we should force sound settings one would suppose. Specifically the settings which are considered the "default" in the KCM, which seems to be rgb sub pixel rendering. So, setting it globally enabled on neon would only hide the bug that the KCM defaults do not reflect the default behavior of Plasma.
Comment 3 Tony 2020-01-13 10:05:56 UTC
Created attachment 125085 [details]
Screenshots before
Comment 4 Tony 2020-01-13 10:06:52 UTC
Created attachment 125086 [details]
Screenshots after
Comment 5 Tony 2020-01-13 10:11:54 UTC
Hello Nathan,
sorry, my mistake. Just attached the images.
Thanks.

PS: I noticed the same link is missing on Ubuntu 18.04 LTS too, but Gtk fonts are already good there. The link has improved the aspect of some Qt apps, like Rosa ImageWriter used to create the live Neon images.
Comment 6 Nate Graham 2020-01-13 14:14:48 UTC
Thanks, that's helpful. TO be clear, before you made this symlink, if you navigated to System Settings > Fonts, did it say "Sub-Pixel Rendering: [RGB]" despite not actually working?
Comment 7 Tony 2020-01-13 14:28:07 UTC
(In reply to Nate Graham from comment #6)
> Thanks, that's helpful. TO be clear, before you made this symlink, if you
> navigated to System Settings > Fonts, did it say "Sub-Pixel Rendering:
> [RGB]" despite not actually working?

Yes, it is enabled by default to RGB but not actually working.
Comment 8 Tony 2020-01-13 14:31:52 UTC
Everyone (with a low resolution screen, sadly) can verify this bug, even with a live system: start the live -> check RGB is enabled -> make the link -> see the difference.
Comment 9 Nate Graham 2020-01-13 14:42:58 UTC
So I guess this is a Plasma bug then, yeah. The KCM should reflect the current state of reality accurately.
Comment 10 Vladimir Yerilov 2020-01-14 13:34:46 UTC
I had to downgrade plasma-workspace to 5.17.4 because it was eye-hurting on 1920x1080 displays.
Comment 11 Nate Graham 2020-04-17 15:20:56 UTC
*** Bug 419135 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2020-04-17 15:22:07 UTC
*** Bug 415707 has been marked as a duplicate of this bug. ***
Comment 13 Patrick Silva 2020-04-19 05:38:12 UTC
*** Bug 420232 has been marked as a duplicate of this bug. ***
Comment 14 Nate Graham 2020-04-24 16:36:45 UTC
*** Bug 415471 has been marked as a duplicate of this bug. ***
Comment 15 Nate Graham 2020-05-05 15:13:25 UTC
I can no longer reproduce this issue with the latest state of git master. Could I ask for testing from others aloso running compiled-from-source code, or using KDE Neon unstable or a git-master-following repo in their distro of choice?
Comment 16 Tony 2020-05-06 16:42:41 UTC
(In reply to Nate Graham from comment #15)
> I can no longer reproduce this issue with the latest state of git master.
> Could I ask for testing from others aloso running compiled-from-source code,
> or using KDE Neon unstable or a git-master-following repo in their distro of
> choice?

Hello Nate,
i've just installed current neon unstable in a VM and taken a look at KCM fonts settings.
I can't no longer see the "Apply" button enabled with no changes made, as per a  bug report added to this one as duplicated, but the original bug regarding sub-pixel-rendering not applied is still there. 
I have attached some files. 
Fonts.conf is the local setting file and there is no trace of rgb sub-pixel rendering enabled into it, even if it is set in KCM.
Two screenshots made with Kate, depicting text with rgb sub-pixel rendering enabled in KCM and no link in /etc/fonts/conf.d and one with the created link. The difference is noticeable, as you can see.
Comment 17 Tony 2020-05-06 16:44:18 UTC
Created attachment 128198 [details]
Local fonts settings.
Comment 18 Tony 2020-05-06 16:45:01 UTC
Created attachment 128199 [details]
Screenshots_unstable_before
Comment 19 Tony 2020-05-06 16:45:27 UTC
Created attachment 128200 [details]
Screenshots_unstable_after
Comment 20 Nate Graham 2020-05-06 17:12:53 UTC
I see. Thanks for the confirmation!
Comment 21 Tony 2020-05-06 18:06:53 UTC
Hello Nate,
i can give you a feedback on the other bugs added as duplicated of this.
I've deleted the symlink to rgb-subpixel-rendering in /etc/fonts/conf.d, logout and login, so the situation is a clean Neon unstable with KDE 5.18.90.

Bug 415471: Can't set sub-pixel rendering to None. 
Status: STILL PRESENT.

Bug 420232: Unexpected confirmation window after switch from "Fonts" section.
Status: FIXED FOR ME.

Bug 419135: On the fonts settings page, the Apply button is enabled, even if there were no changes.
Status: As previously said, FIXED FOR ME.

Bug 415707: fedora31/plasma 5.17.4 subPixelRendering RGB not taken into account after logoff/login
Status: STILL PRESENT. No need to logout/login, changes made to fonts rendering are rejected, dolphin never gets rgb as reported by user.
Comment 22 Tony 2020-05-24 21:14:34 UTC
I can add a comment:
fresh neon user-edition installation (20200514), first access in KCM fonts, we have the button Apply enabled and are being asked to Accept, Discard, Delete with no action done. This happens only the first time. Next accesses in KCM fonts are good: you do nothing, you are not being asked anything. News is, on the first access, if you Accept the settings, the file ~/.config/fontconfig/fonts.conf is created and it contains the setting:  

<edit name="rgba" mode="assign">
   <const>rgb</const>

that applies rgb-subpixel rendering without creating the global link. 
Screenshots have been added.
So, now the settings actually reflect the machine status. 
Last problem left is creating the fonts.conf without forcing the user to Accept a request he has never done.
Comment 23 Tony 2020-05-24 21:17:44 UTC
Created attachment 128755 [details]
Screenshots before link on neon-user
Comment 24 Tony 2020-05-24 21:18:19 UTC
Created attachment 128756 [details]
Screenshots after link on neon-user
Comment 25 Tony 2020-05-24 21:27:19 UTC
I forgot to mention that on first access to KCM fonts, if you do not Accept the settings, next times you are being asked to accept over and over, probably because file fonts.conf is not created. Once you accept, file is created, requests finish and accesses to KCM fonts are normal.
Comment 26 nyanpasu64 2021-02-05 09:09:10 UTC
I suspect https://bugs.kde.org/show_bug.cgi?id=431197 is related to this bug. I'm now receiving similar symptoms with the same workaround (add a symlink), but my issues started months after this bug report.
Comment 27 Harald Sitter 2021-02-05 16:57:39 UTC
The KCM currently never writes the RGB setting from what I can tell. Culprit is FontAASettingsStore which seems to never set m_subPixelChanged and thus never syncs it into the Config object for writing to disk. Which in the end means the setting is just never added to the user config.

At a glance m_hintingChanged may have the same problem, not sure if there's a bug report about hinting possibly also not applying. @Nate?

Both only apply if and only if the config replicated by https://bugs.kde.org/show_bug.cgi?id=432539 don't already contain the setting. IOW if the config file already has a value it will get updated, if it doesn't it never gets added to the file because of the bug in the SettingsStore.
Comment 28 Vladimir Yerilov 2021-02-14 11:30:52 UTC
There's another aspect of this problem. Adding a symlink to /etc/fonts/conf.d resolves sub-pixel rendering in general, but some parts of Plasma and KDE apps do not benefit from that setting. Affected parts are:
1. Okular's contents (not just some specific filetypes, anything, even txt files are grey-scale). Okular's UI elements are fine though.
2. Some parts of KInfoCenter: its Energy section has grey-scale buttons "Change Percentage" and "Energy Consumption", and below is affected graph's labels comprised of small blurry numbers.
Comment 29 Harald Sitter 2021-02-15 10:47:58 UTC
Those would be different bugs that need filing separately against the apps. If fontconfig is set up correctly then certain apps not behaving accordingly is likely a problem with Qt or the app.

You may be asking how to tell ^^

If this command

> fc-match -v|grep -i rgba

outputs the correct value then fontconfig is technically correctly configured. Correct values are: 1(rgb), 2(bgr), 3(vrgb), 4(vbgr)
Comment 30 Vladimir Yerilov 2021-02-15 11:38:39 UTC
Created attachment 135695 [details]
Text file opened in Okular

This is just a common text file opened in Okular, not even a PDF.
On top: Okular's toolbar, rgb applied.
On bottom: Okular document view, text is rendered with "50 shades of grey" lol.
Comment 31 Vladimir Yerilov 2021-02-15 11:41:59 UTC
Created attachment 135696 [details]
KInfoCenter's "Energy" section

On top: greyscaled blurry time marks that belong to battery discharge graph.
On bottom: just a header of info text describing battery details.
Comment 32 Vladimir Yerilov 2021-02-15 11:44:04 UTC
Hi Harald,
This is what I received in response to your cmd:
      rgba: 1(i)(w)
Comment 33 Harald Sitter 2021-02-15 11:54:51 UTC
You need to file separate bugs for these things. They have nothing to do with this bug.
Comment 34 Vladimir Yerilov 2021-02-15 17:00:47 UTC
Yeah, bug reports are already in place, but anyway, I believe sharing these notes here as well is worthwhile since this bugreport is about the only setting in Plasma that (somehow) relates to the described effects, and that setting doesn't work neither system-wide (symlink needed) nor for apps I mentioned. All I hope for is that due to bigger audience someone would check/confirm, some would report a similar issue, and someone might even fix it eventually.
Comment 36 Cyril Rossi 2021-03-17 11:22:07 UTC
Git commit aa840a9d08d62d88487db4096b2e7a0e73c977d2 by Cyril Rossi.
Committed on 17/03/2021 at 08:30.
Pushed by crossi into branch 'master'.

KCM Fonts .fonts.conf was not updated and enforce consistency through UI

If some elements in .fonts.conf were deleted (default), they weren't updated anymore, and cause inconsistency between the value displayed in the KCM and what is actually applied.
UI consistency : when the user uncheck enable AA, then the style is set to None instead of default value.

M  +42   -19   kcms/fonts/fontsaasettings.cpp
M  +2    -2    kcms/fonts/fontsaasettings.h

https://invent.kde.org/plasma/plasma-workspace/commit/aa840a9d08d62d88487db4096b2e7a0e73c977d2
Comment 37 Nate Graham 2021-03-17 18:37:30 UTC
Thanks for that, Cyril! What more needs to be done to call this bug fixed?
Comment 38 nyanpasu64 2021-06-22 23:58:40 UTC
Works in Plasma 5.22. Should this bug be closed, marked as duplicate of https://bugs.kde.org/show_bug.cgi?id=431197, or should that bug be marked as a duplicate of this?
Comment 39 Tony 2021-06-23 09:13:42 UTC
(In reply to nyanpasu64 from comment #38)
> Works in Plasma 5.22. Should this bug be closed, marked as duplicate of
> https://bugs.kde.org/show_bug.cgi?id=431197, or should that bug be marked as
> a duplicate of this?

This bug is somehow changed, but still persists in some conditions.
I've deleted the symbolic link that applies sub pixel rendering system wide.
I can see that user specific settings are present in ~/.config/fontconfig/fonts.conf and correctly applied:

tony@thinkpad-x230:~/.config/fontconfig$ cat fonts.conf | grep rgb
  <edit name="rgba" mode="assign">
   <const>rgb</const>

but NOT if file fonts.conf is missing.
If i delete fonts.conf and open fonts kcm, fonts.conf doesn't get created; kcm still shows RGB set but it is *not* actually applied. Same situation after a system reboot.
If i change some settings in fonts kcm, e.g. changing pixel rendering to none, then fonts.conf is created and settings are correctly applied. Changing again pixel rendering to rgb finally works.
So, conclusions are: on KDE Neon when file font.conf is missing, such as on a freshly installed system, or if it is deleted, it should be recreated as soon as possible, either by copying a skeleton system file, either by reflecting system wide settings. In the last case, as rgb-subpixel rendering symlink is missing, it should be set to none in kcm, to reflect system state.
For a new user, fonts kcm is in an inconsistent state, showing settings not actually applied, so bug is still present.
Comment 40 nyanpasu64 2021-06-23 09:17:25 UTC
*** Bug 431197 has been marked as a duplicate of this bug. ***
Comment 41 PJSingh5000 2021-06-26 03:23:24 UTC
Created attachment 139667 [details]
Test using Plasma 5.22.1 showing full font hinting is not applied.

See the attached image showing the results of three different tests using neon-user-20210617-0945.iso with Plasma 5.22.1:
1. The default settings
2. After setting Full hinting
3. After installing and setting Roboto fonts (package fonts-roboto-fontface); Full hinting is still active from test #2.

Anti-aliasing is enabled by default for all tests.

Notice that all three tests do not have the colored fringes around the fonts.

(See attached file: Comparison Slight and Full Hinting in Plasma 5.22.1 (2021-06-25).jpg)
Comment 42 nyanpasu64 2021-06-26 03:26:10 UTC
"Hinting" affects whether characters are reshaped to fit the pixel grid, and does not affect color fringing. "Sub-pixel rendering" affects whether colors are used to represent sub-pixel detail. What is the value of "Sub-pixel rendering", and do colors appear when you set it to RGB (or alternatively set it to something else and back to RGB)?
Comment 43 PJSingh5000 2021-06-26 16:12:04 UTC
Thanks for the clarification and explanation!
RGB was enabled by default, so I did not change that.
I will retest and change this to something else, and back to RGB.
Comment 44 soredake 2022-01-27 11:40:39 UTC
Still a problem with fedora kde 35.
Comment 45 Michal Dvorak 2022-02-11 10:21:50 UTC
I also had a problem to set the RGB subpixel rendering in Debian 11 with KDE and I guess it's this bug when KDE Fonts Settings doesn't set the ```````"rgba"  property in fonts.conf file. I fixed it by generating the file by the utility **qt5ct** which creates the correct config file.

I described it here: https://unix.stackexchange.com/questions/690088/how-to-enable-rgb-subpixel-font-anti-aliasing-in-kde-plasma
Comment 46 Nate Graham 2022-09-08 17:31:07 UTC
*** Bug 431197 has been marked as a duplicate of this bug. ***
Comment 47 Bug Janitor Service 2022-09-19 10:40:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2140
Comment 48 Harald Sitter 2022-09-20 09:17:03 UTC
Git commit 5dd8cc919f54bf28152a80e1fa6f3f649ea4e47a by Harald Sitter.
Committed on 20/09/2022 at 09:10.
Pushed by sitter into branch 'master'.

fonts: honor & present system defaults

previously we'd pretend that a missing value meant our "plasma-ish"
defaults would apply but that is utterly false. when no hitting is set,
no hinting is set. this can happen when the system default fontconfigs
don't set up any hinting.

M  +5    -4    kcms/fonts/fontsaasettings.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/5dd8cc919f54bf28152a80e1fa6f3f649ea4e47a
Comment 49 Harald Sitter 2022-09-20 09:17:31 UTC
Git commit 2539a5667418ee78330c2a79224196fb28a94494 by Harald Sitter.
Committed on 20/09/2022 at 09:17.
Pushed by sitter into branch 'Plasma/5.26'.

fonts: honor & present system defaults

previously we'd pretend that a missing value meant our "plasma-ish"
defaults would apply but that is utterly false. when no hitting is set,
no hinting is set. this can happen when the system default fontconfigs
don't set up any hinting.


(cherry picked from commit 5dd8cc919f54bf28152a80e1fa6f3f649ea4e47a)

M  +5    -4    kcms/fonts/fontsaasettings.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/2539a5667418ee78330c2a79224196fb28a94494
Comment 50 Harald Sitter 2022-09-20 09:17:54 UTC
Git commit dc24b7c1c4e2c9dfb74090f716da029e44e209ff by Harald Sitter.
Committed on 20/09/2022 at 09:17.
Pushed by sitter into branch 'Plasma/5.24'.

fonts: honor & present system defaults

previously we'd pretend that a missing value meant our "plasma-ish"
defaults would apply but that is utterly false. when no hitting is set,
no hinting is set. this can happen when the system default fontconfigs
don't set up any hinting.


(cherry picked from commit 5dd8cc919f54bf28152a80e1fa6f3f649ea4e47a)

M  +5    -4    kcms/fonts/fontsaasettings.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/dc24b7c1c4e2c9dfb74090f716da029e44e209ff