Disable Sub-Pixel-Antialiasing for Text component?
-
wrote on 30 Nov 2017, 14:52 last edited by
Hi, Qt specialists.
Since the Sub-Pixel-Antialiasing performs bad on some transparent backgrounds especially when rendering small fonts, how could I disable this feature?sub-pixel-antialiasing enabled:
sub-pixel-antialiasing disabled:
I think setting
QFont::NoSubpixelAntialias
style strategy might help, but it seems that's impossible to do it with a Text component in QML.Environment: Windows 10 with Qt 5.9 x64
Thank you for any ideas.
-
wrote on 30 Nov 2017, 17:40 last edited by
Hi! Setting
renderType
toText.NativeRendering
usually yields better results than the default:Text { text: "Hello"; renderType: Text.NativeRendering; }
-
wrote on 1 Dec 2017, 08:41 last edited by
Thanks for your advice, Wieland.
That doesn't remove the artificial colors completely, but the results now become acceptable.Thank you so much!
-
wrote on 21 Dec 2017, 12:37 last edited by
Finally, I found that using FreeType as Qt's font engine would get the best result when rendering over transparent background for both large and small font glyphs.
This could be done usingqt.conf
:[Platforms] WindowsArguments = fontengine=freetype
or using command line argument:
<application> -platform windows:fontengine=freetype
Note that this won't remove artificial colors for sub-pixel-antialiasing, to disable it, add these lines in your
Text
component:style: Text.Outline styleColor: "transparent"