Bug 134275 - Skia: Windows ClearType settings not observed causing poor font rendering
Summary: Skia: Windows ClearType settings not observed causing poor font rendering
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
7.0.0.0.beta1+
Hardware: x86-64 (AMD64) Windows (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0 target:7.0.0.2
Keywords:
Depends on:
Blocks: Skia
  Show dependency treegraph
 
Reported: 2020-06-24 01:42 UTC by Joshua
Modified: 2020-07-28 09:11 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua 2020-06-24 01:42:32 UTC
Description:
Color subpixel antialiasing with Skia+Vulkan rendering is inaccurate on BGR ordered display, making text difficult to read. 

Steps to Reproduce:
1. Options > View > Graphics Output > Use Skia for all rendering CHECKED
2. Have a display that is not compatible (i.e. BGR) with the default settings Skia assumes

Actual Results:
All text rendering, including UI elements as well as in documents, lacks clarity due to being iridescent around the edges

https://i.imgur.com/nJS9ntK.png

Expected Results:
Fonts should render the same with Skia as they do with "Use Skia for all rendering" unchecked

https://i.imgur.com/CU9Uj6Z.png

The differences in the screenshots will either not be apparent or seem *reversed* on a typical RGB monitor. e.g. on a standard RGB screen, the Skia *off* might appear iridescent or blurry, while Skia *on* look fine. Trust me when I say that is not the case on my display!

For more info see: http://www.lagom.nl/lcd-test/subpixel.php


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Technical note: 

Skia requires a preprocessor directive in order to read the ClearType parameters from system settings, which includes pixel order as well as contrast and gamma.

https://skia.googlesource.com/skia/+/refs/heads/master/src/ports/SkTypeface_win_dw.cpp#395

https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/cleartype-registry-settings

This might explain the SK_GAMMA_APPLY_TO_A8 issue described in this commit:

https://cgit.freedesktop.org/libreoffice/core/commit/external/skia?id=1ad3f6b8d9e0ef1e921c3ed5526ea352d67265cf

Adding #define SK_FONT_HOST_USE_SYSTEM_SETTINGS 1 to config_skia.h.in would probably solve the issue.

https://cgit.freedesktop.org/libreoffice/core/tree/config_host/config_skia.h.in

Then the user could tune the level of ClearType antialiasing using Windows built-in the "Adjust ClearType Text" Control Panel applet if it was not satisfactory. However, Windows usually sets the correct subpixel order by default.
Comment 1 Commit Notification 2020-07-07 09:45:43 UTC
Luboš Luňák committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fada69d6ee05700fd57c8844591562608a900a9d

set also RGB/BGR LCD order for Skia text rendering (tdf#134275)

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 2 Luboš Luňák 2020-07-07 09:50:19 UTC
What is meant to be the actual problem with the gamma/contrast settings? It's unrelated to the RGB/BGR problem, and it's not enabled by default in Skia, so I do not want to enable it just like that. And it doesn't look related to SK_GAMMA_APPLY_TO_A8, my commit changes the file for non-DirectWrite Skia code, while SK_FONT_HOST_USE_SYSTEM_SETTINGS is used only by the code that does use DirectWrite.
Comment 3 Commit Notification 2020-07-13 20:59:03 UTC
Luboš Luňák committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/1171d609c52fc1f7cd58787e9ebc1ecca32fe450

set also RGB/BGR LCD order for Skia text rendering (tdf#134275)

It will be available in 7.0.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Luboš Luňák 2020-07-28 09:11:19 UTC
No further info, the actual problem is fixed, closing.