Bug 432320 - Sub-pixel rendering and hinting previews do not work in Wayland
Summary: Sub-pixel rendering and hinting previews do not work in Wayland
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_fonts (show other bugs)
Version: 6.0.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Du Yijie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-30 19:28 UTC by Bruno Guedes
Modified: 2024-03-23 03:24 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.3


Attachments
sub_pixel_rendering_combo-box_highlighting (132.93 KB, image/png)
2021-01-30 19:29 UTC, Bruno Guedes
Details
correct_combo-box (126.77 KB, image/png)
2021-01-30 19:36 UTC, Bruno Guedes
Details
Correct behaviour on X11 with KDE 5.32.2 (36.68 KB, image/png)
2021-11-05 19:49 UTC, Oliver Beard
Details
Incorrect behaviour on Wayland with KDE 5.32.2 [1] (18.33 KB, image/png)
2021-11-05 19:50 UTC, Oliver Beard
Details
Incorrect behaviour on Wayland with KDE 5.32.2 [2] (18.37 KB, image/png)
2021-11-05 19:50 UTC, Oliver Beard
Details
Incorrect behavior on Plasma 6.0.1 (14.76 KB, image/png)
2024-03-08 06:26 UTC, Du Yijie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Guedes 2021-01-30 19:28:15 UTC
SUMMARY

The highlighting for the options in the sub-pixel rendering and hinting combo-boxes are inconsistent with the other combo-boxes throughout the plasma system settings.

The highlighting in those are a faint blue(in breeze dark) and they don't go through the entire box length.


STEPS TO REPRODUCE
1. open system settings > appearance > fonts.
2. click in the sub-pixel rendering or hinting options and hover your cursor over the options.
3. see that the highlighting stops just after the last letter of the option's name instead of continuing until the end of the combo-box.


SOFTWARE/OS VERSIONS

Operating System: Manjaro Linux
KDE Plasma Version: 5.21.80
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.9.16-1-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-6200U CPU @ 2.30GHz
Memory: 7,2 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 520 

ADDITIONAL INFORMATION

it happens in wayland and in X11
Comment 1 Bruno Guedes 2021-01-30 19:29:09 UTC
Created attachment 135310 [details]
sub_pixel_rendering_combo-box_highlighting
Comment 2 Bruno Guedes 2021-01-30 19:36:17 UTC
Created attachment 135311 [details]
correct_combo-box

"Switch desktop on edge"'s combo-box which is an example of a correnct combo-box.
with correct I mean consistent with the other combo-boxes.
Comment 3 Nate Graham 2021-02-01 18:02:47 UTC
Something is odd here. There's supposed to be a preview of the hinting style in the combobox items, but it's not visible in your screenshot.
Comment 4 Patrick Silva 2021-06-03 19:55:53 UTC
Yes, previews of font hinting and sub-pixel rendering are missing on Wayland.
Comment 5 Oliver Beard 2021-11-05 19:49:40 UTC
Created attachment 143258 [details]
Correct behaviour on X11 with KDE 5.32.2
Comment 6 Oliver Beard 2021-11-05 19:50:27 UTC
Created attachment 143259 [details]
Incorrect behaviour on Wayland with KDE 5.32.2 [1]
Comment 7 Oliver Beard 2021-11-05 19:50:44 UTC
Created attachment 143260 [details]
Incorrect behaviour on Wayland with KDE 5.32.2 [2]
Comment 8 Oliver Beard 2021-11-05 19:54:46 UTC
Still an issue, and definitely due to broken previews on X11. There are also several other issues, even with working previews: 
- The highlight colour is still wrong 
- The preview's backgrounds don't match the highlight or selection box dropdown colour
- The highlight/click target for each option does not extend the full width of the box (even in X11), but rather just close to.
Comment 9 Du Yijie 2024-03-08 06:26:35 UTC
Created attachment 166680 [details]
Incorrect behavior on Plasma 6.0.1

Also reproduced in a virtual machine with Neon unstable.
Comment 10 Du Yijie 2024-03-16 02:39:08 UTC
Merge request submitted: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4076
Comment 11 Fushan Wen 2024-03-16 13:00:11 UTC
Git commit 499e096d87d38ae4b9b194797520aaaf2450f33f by Fushan Wen, on behalf of Du Yijie.
Committed on 16/03/2024 at 12:39.
Pushed by fusionfuture into branch 'Plasma/6.0'.

kcm_fonts: add subpixel and hinting previews

This commit adds subpixel and hinting previews to kcm_fonts under
Wayland.

To properly support fractional scaling, PreviewRenderEngine now querys
the scale from focus window, which returns the right scale for the
currently active window (which should be the font settings page when
the dropdown is clicked), rather than the primary screen which can only
return the next higher integer scale. The DPI query is changed to query
the active window's QScreen rather than X11.

The naive reenablement has a bug where the preview image's size will
grow larger than the bounding box of the preview text. It turns out that
QImage::setDevicePixelRatio adds margins to the image, and removing that
call solves the issue somehow.

There are some minor display issues like the preview being blurry under
fractional scales, but it at least works. Somehow.


(cherry picked from commit be7af9da65375d2dc76962d5bd25b8a525f3174e)

M  +0    -3    kcms/fonts/previewimageprovider.cpp
M  +5    -7    kcms/fonts/previewrenderengine.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/499e096d87d38ae4b9b194797520aaaf2450f33f