[Linux] How to enable sub-pixel rendering for Qt Quick/QML 6.5.3?
-
wrote 24 days ago last edited by
Hi!
(I'd to remove relevant information due to be marked as Spam by Aksmet .com)
We've problems enablling sub-pixel rendering for Qt Quick/QML.
First of all we're using Qt 6.5.3 and sub-pixel rendering is system wide enabled via font-config.
To verify that sub-pxel rendering works at all with a native Qt application we've used fontsampler example:
Nevertheless we're unable to enable sub-pixel rendering for Qt Quick/QML. To verify that we've used the textexample from qtdeclarative:
From what we've read Qt Quick/QML can render text in various ways:
- QtTextRendering
- NativeTextRendering
CurveTextRendering(since 6.7.0)
Qt Quick/QML is using QtTextRendering per default. So to change the default behavior and to enable native rendering (which will enable sub-pixel rendering hopefully as well) one can either
- Call setTextRenderType()
- Build qtdeclarative with different build options as mentioned here and here. But with a different keyword: "NativeTextRendering" insteadof "NativeRendering" as mentioned here.
However, none of both of options enabled sub-pixel rendering in our case, even if sub-pixel rendering works with native Qt.
To verify that our changes really applied we added a short code snippet to our Qt Quick/QML application:
qInfo("QQuickWindow::QtTextRendering = 0x%x", QQuickWindow::QtTextRendering); qInfo("QQuickWindow::NativeTextRendering = 0x%x", QQuickWindow::NativeTextRendering); qInfo("old render type = 0x%x", window->textRenderType()); window->setTextRenderType(QQuickWindow::NativeTextRendering); qInfo("new render type = 0x%x", window->textRenderType());
The output is on the first option:
QQuickWindow::QtTextRendering = 0x0 QQuickWindow::NativeTextRendering = 0x1 old render type = 0x0 new render type = 0x1
and on the second option:
QQuickWindow::QtTextRendering = 0x0 QQuickWindow::NativeTextRendering = 0x1 old render type = 0x1 new render type = 0x1
So our changes apply but sub-pixel rendering is not enabled/visible.
How can we enable sub-pixel rendering with an Qt Quick/QML application?
Thank you!
1/1