From 247bd54fd248165166a0a4fd1039ca3e6b42b24a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 17 Jun 2021 13:37:51 +0200 Subject: [PATCH] Fix right-to-left text with DirectWrite engine + QPainterPath When QPainterPath was used for RTL text, either directly or because the target text size exceeds 64 pixels, we would pass true for "isRightToLeft" to DirectWrite, causing it to do adaptation internally for this. But the RTL layout had already been handled by Qt, so we would essentially reverse the layout twice and also move the text to negative X coordinates. Passing false instead fixes this, as it will then just use the positions we pass in blindly. Fixes: QTBUG-94175 Change-Id: Ie9a47e56e97fc867ede10ab21ac5e3f003ddcacb Reviewed-by: Lars Knoll (cherry picked from commit 30399fb95cf8b528ac4b45766ac55c6f0a16e2f4) Reviewed-by: Qt Cherry-pick Bot --- src/gui/text/windows/qwindowsfontenginedirectwrite.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp index 20063a0610b..95d13911138 100644 --- a/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp @@ -517,6 +517,7 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn void QWindowsFontEngineDirectWrite::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags) { + Q_UNUSED(flags); QVarLengthArray glyphIndices(nglyphs); QVarLengthArray glyphOffsets(nglyphs); QVarLengthArray glyphAdvances(nglyphs); @@ -536,7 +537,7 @@ void QWindowsFontEngineDirectWrite::addGlyphsToPath(glyph_t *glyphs, QFixedPoint glyphOffsets.data(), nglyphs, false, - flags & QTextItem::RightToLeft, + false, &geometrySink );