Created attachment 200518 [details] Text in Writer with Skia-backend enabled Using the Skia-backend on Windows and X11, text is rendered too bold on white backgrounds and too light on dark backgrounds. There is also colour bleeding if you choose colours with a low brightness contrast, like pure green and pure red. Similar to this bug report: https://github.com/AvaloniaUI/Avalonia/issues/5282 There are also pronounced colour fringes from the Cleartype-like rendering. I suspect, the Skia renderer is not applying correct gamma blending, i.e. is doing the linear blending in the sRGB colour-space. The sRGB colour-space has a gamma function on its values, e.g. RGB 128,128,128 is *not* neutral grey, but darker. Some background reading about gamma correct font rendering: > https://www.puredevsoftware.com/blog/2019/01/22/sub-pixel-gamma-correct-font-rendering/ > https://freetype.org/freetype2/docs/hinting/text-rendering-general.html > https://blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/ Windows is using a gamma of 1.9 internally for font rendering with Cleartype, one could change these settings with Cleartype-Tuner, but it has become merely disfunctional. > https://learn.microsoft.com/de-de/dotnet/desktop/wpf/advanced/cleartype-registry-settings?view=netframeworkdesktop-4.8 Qt, starting at some point in the version 5 life-cycle, is also using 1.9: > https://mail.kde.org/pipermail/kde/2017-December/028694.html Chromium used hard-coded values for its different platforms, but a large patch from Microsoft changed that on Windows, modern Edge is using that for some time now: > https://developer.chrome.com/blog/better-text-rendering-in-chromium-based-browsers-on-windows I couldn't find the lines in the codebase that handle the text rendering, I would appreciate any help to find them, so I can understand what's going on.
Created attachment 200519 [details] Text in Writer with Skia-backend disabled (gdi based rendering?)
Note that even with the old rendering on Windows, which is slightly better than Skia, you still have contrast issues in the red on green example.
Created attachment 200520 [details] Text in MS Edge with default settings (also using Skia) The rendering in Edge is mostly correct, slight contrast issue in the green on red text due to gamma 1.9 instead of 2.2
Interestingly we are patching Skia with: 1ad3f6b8d9e0ef1e921c3ed5526ea352d67265cf "(do not) use SK_GAMMA_APPLY_TO_A8 also for Skia text on Windows This is the Windows variant of the SK_GAMMA_APPLY_TO_A8 disabling, again I don't quite understand why we need to disable this, but with this patch Skia text rendering on Windows seems to be pixel-perfect when compared with the VCL gen backend."
Created attachment 201612 [details] Text with and without windows-text-gamma.patch.0 On the left side is with the Skia patch, on the right is without. Note the dark fringing around the red/green text on the left.
(In reply to Buovjaga from comment #4) > Interestingly we are patching Skia with: > 1ad3f6b8d9e0ef1e921c3ed5526ea352d67265cf > > "(do not) use SK_GAMMA_APPLY_TO_A8 also for Skia text on Windows > > This is the Windows variant of the SK_GAMMA_APPLY_TO_A8 disabling, > again I don't quite understand why we need to disable this, > but with this patch Skia text rendering on Windows seems to be > pixel-perfect when compared with the VCL gen backend." Confirmed: the bug is being caused by this patch.
Jonathan Clark committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/bfa28a257ae621747dddbb61f228705cf46079b8 tdf#166339 vcl: Removed Windows skia text gamma patch It will be available in 26.2.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.
(In reply to Commit Notification from comment #7) > Jonathan Clark committed a patch related to this issue. > It has been pushed to "master": > > https://git.libreoffice.org/core/commit/ > bfa28a257ae621747dddbb61f228705cf46079b8 > > tdf#166339 vcl: Removed Windows skia text gamma patch I tested on Windows and the green fringing in bold Chinese text reported in bug 153456 is gone. I notice the UI text becomes a lighter, comparing back and forth with two LibreOffice versions, looking at the main menu or a dialog like Help - About. You might even call it faint, so I wonder if it would lead to complaints. Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: bfa28a257ae621747dddbb61f228705cf46079b8 CPU threads: 2; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win Locale: en-US (en_US); UI: en-US Calc: threaded
Tobias: you are, of course, invited to test with a daily build: https://dev-builds.libreoffice.org/daily/master/current.html
Jonathan Clark committed a patch related to this issue. It has been pushed to "libreoffice-25-8": https://git.libreoffice.org/core/commit/8efaebbc54c3be7d76d9d0a9480f8d47473c65cf tdf#166339 vcl: Removed Windows skia text gamma patch It will be available in 25.8.0.0.beta2. 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.
Jonathan Clark committed a patch related to this issue. It has been pushed to "libreoffice-25-2": https://git.libreoffice.org/core/commit/9f509a54f61740785a1f135ddec99573ba3e8a41 tdf#166339 vcl: Removed Windows skia text gamma patch It will be available in 25.2.6. 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.
I'm still investigating the X11 and MacOS versions of this bug. What I'm seeing looks like the artifacts I'd expect from Skia's own gamma hack, but I need to properly validate that. https://skia.org/docs/dev/design/raster_tragedy/ (In reply to Buovjaga from comment #8) > I tested on Windows and the green fringing in bold Chinese text reported in > bug 153456 is gone. If there are no objections, I think it's safe to mark bug 153456 a duplicate of this bug. > I notice the UI text becomes a lighter, comparing back > and forth with two LibreOffice versions, looking at the main menu or a > dialog like Help - About. You might even call it faint, so I wonder if it > would lead to complaints. windows-text-gamma.patch.0 had a negative effect on subpixel antialiasing (demonstrated quite well by bug 153456). I can't rule out user complaints, but I think it would be better to address them by adjusting our UI font sizes on Windows, rather than relying on math tweaks that break ClearType.
Created attachment 201638 [details] ScreenshotA
Created attachment 201639 [details] Screenshot
Created attachment 201640 [details] Screenshot
(In reply to Jonathan Clark from comment #12) > > I notice the UI text becomes a lighter, comparing back > > and forth with two LibreOffice versions, looking at the main menu or a > > dialog like Help - About. You might even call it faint, so I wonder if it > > would lead to complaints. It's little faint, indeed. It's bit worse for for me with Dark UI. It's especially the UI font. The text in the main editor is fine > windows-text-gamma.patch.0 had a negative effect on subpixel antialiasing > (demonstrated quite well by bug 153456). I can't rule out user complaints, > but I think it would be better to address them by adjusting our UI font > sizes on Windows, rather than relying on math tweaks that break ClearType. I'm unsure if you should backport it 25.2 already. Font rendering is pretty essential. The current approach has been proven since 2020, without many bug reports. Testing the waters first seems a better approach, IMHO.
*** Bug 153456 has been marked as a duplicate of this bug. ***
(In reply to Telesto from comment #16) > I'm unsure if you should backport it 25.2 already. Font rendering is pretty > essential. The current approach has been proven since 2020, without many bug > reports. Testing the waters first seems a better approach, IMHO. Patch went into 25.2.6, which will be released in September, so at least there is time to test: https://wiki.documentfoundation.org/ReleasePlan/25.2#25.2.6_release
Created attachment 201642 [details] Comparison screenshot Screenshot comparing UI text in light and dark mode, with and without the patch. This screenshot uses subpixel antialiasing, so may look different depending on your monitor's subpixel layout. In light mode, UI text appears to have a lighter weight with the patch than without. In dark mode, the situation is reversed.
Created attachment 201643 [details] Comparison screenshot detail Another comparison screenshot, zoomed to show pixel-level differences. Without the patch, there is intense green color fringing on most characters. In light mode, the fringing is on the outside of the glyphs. In dark mode, it is inside of the glyphs. With the patch, the color fringing more accurately represents the subpixel coverage of the glyphs.
(In reply to Telesto from comment #16) > (In reply to Jonathan Clark from comment #12) > > > I notice the UI text becomes a lighter, comparing back > > > and forth with two LibreOffice versions, looking at the main menu or a > > > dialog like Help - About. You might even call it faint, so I wonder if it > > > would lead to complaints. > > It's little faint, indeed. It's bit worse for for me with Dark UI. It's > especially the UI font. The text in the main editor is fine Posted some additional UI text comparison screenshots to make sure we're on the same page. What I've observed is that the text has less weight in light mode, but more weight in dark mode.
Jonathan Clark committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6e7860f021b27193b44f803b1e39f3508559bb47 tdf#166339 vcl: Use gamma-corrected font rendering in Skia It will be available in 26.2.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.
(In reply to Jonathan Clark from comment #21) > Posted some additional UI text comparison screenshots to make sure we're on > the same page. What I've observed is that the text has less weight in light > mode, but more weight in dark mode. Yes, same here