Disable Sub-Pixel-Antialiasing for Text component?
-
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.
-
Hi! Setting
renderType
toText.NativeRendering
usually yields better results than the default:Text { text: "Hello"; renderType: Text.NativeRendering; }
-
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"