summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/qt/FontQt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/qt/FontQt.cpp')
-rw-r--r--Source/WebCore/platform/graphics/qt/FontQt.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/qt/FontQt.cpp b/Source/WebCore/platform/graphics/qt/FontQt.cpp
index 3eead7e70..ab11c5199 100644
--- a/Source/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontQt.cpp
@@ -59,9 +59,11 @@ static const QString fromRawDataWithoutRef(const String& string, int start = 0,
return QString::fromRawData(reinterpret_cast<const QChar*>(string.characters() + start), len);
}
-static QTextLine setupLayout(QTextLayout* layout, const TextRun& style)
+static QTextLine setupLayout(QTextLayout* layout, const TextRun& style, bool shouldSetDirection)
{
- int flags = style.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
+ int flags = 0;
+ if (shouldSetDirection || style.directionalOverride())
+ flags |= style.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
if (style.expansion())
flags |= Qt::TextJustificationForced;
layout->setCacheEnabled(true);
@@ -187,7 +189,7 @@ public:
m_layout.setText(string);
m_layout.setRawFont(font.rawFont());
font.initFormatForTextLayout(&m_layout, run);
- m_line = setupLayout(&m_layout, run);
+ m_line = setupLayout(&m_layout, run, false);
}
float width(unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)
@@ -239,7 +241,7 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float
QTextLayout layout(string);
layout.setRawFont(rawFont());
initFormatForTextLayout(&layout, run);
- QTextLine line = setupLayout(&layout, run);
+ QTextLine line = setupLayout(&layout, run, true);
const QPointF adjustedPoint(point.x(), point.y() - line.ascent());
QList<QGlyphRun> runs = line.glyphRuns(from, to - from);
@@ -263,7 +265,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
QTextLayout layout(string);
layout.setRawFont(rawFont());
initFormatForTextLayout(&layout, run);
- QTextLine line = setupLayout(&layout, run);
+ QTextLine line = setupLayout(&layout, run, false);
float x1 = line.cursorToX(0);
float x2 = line.cursorToX(run.length());
float width = qAbs(x2 - x1);
@@ -279,7 +281,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float position, bo
QTextLayout layout(string);
layout.setRawFont(rawFont());
initFormatForTextLayout(&layout, run);
- QTextLine line = setupLayout(&layout, run);
+ QTextLine line = setupLayout(&layout, run, false);
return line.xToCursor(position);
}
@@ -291,7 +293,7 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint
QTextLayout layout(string);
layout.setRawFont(rawFont());
initFormatForTextLayout(&layout, run);
- QTextLine line = setupLayout(&layout, run);
+ QTextLine line = setupLayout(&layout, run, false);
float x1 = line.cursorToX(from);
float x2 = line.cursorToX(to);