aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2022-10-04 09:07:10 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-10-11 18:29:27 +0000
commit2d819ee839e1fbeb724bb91b0b4434bf6711663b (patch)
treeefcad09d353ce36f5831e9c889c526deaf67e9a0
parent7ade61593424910a63085cef8203feb4bae4ec06 (diff)
Fix broken Text rendering when noantialiased NativeRendering is used
In case antialiasing is disabled the QFontEngine::Format_Mono is used to render in the glyph cache. In this format the padding needs to be 8-bit aligned. Fixes: QTBUG-107038 Change-Id: Icc3c69fe0395cea9954c2fa07c39e7769fc91800 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit cba96b3a97977f71931f311db9d5644d1d74d694) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/scenegraph/qsgrhitextureglyphcache.cpp5
-rw-r--r--tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml25
2 files changed, 29 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
index da9db65bc8..e46a2d9556 100644
--- a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
+++ b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
@@ -233,7 +233,10 @@ void QSGRhiTextureGlyphCache::endFillTexture()
int QSGRhiTextureGlyphCache::glyphPadding() const
{
- return 1;
+ if (m_format == QFontEngine::Format_Mono)
+ return 8;
+ else
+ return 1;
}
int QSGRhiTextureGlyphCache::maxTextureWidth() const
diff --git a/tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml b/tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml
new file mode 100644
index 0000000000..92598eb490
--- /dev/null
+++ b/tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+//vary font style, native rendering without antialiasing
+
+Item {
+ id: topLevel
+ width: 320
+ height: 580
+
+ Repeater {
+ model: [Text.Normal, Text.Outline, Text.Raised, Text.Sunken]
+ Text {
+ y: 20 * index
+ clip: true
+ renderType: Text.NativeRendering
+ width: parent.width
+ wrapMode: Text.Wrap
+ font.pointSize: 10
+ style: modelData
+ styleColor: "green"
+ antialiasing: false
+ text: "The quick fox jumps in style " + modelData
+ }
+ }
+}