Support RTL text with merge font engines

Text like Urdu use mixed RTL scripts from Persian, Arabic and so on.
In RTL, sub glyph runs for individual font engines must be added from
end to start, so that the positions can still be calculated in a left
to right manner.

Task-number: QTBUG-23404
Change-Id: I7e55e4b7b858b3abbe94e352c93d36de6226ff58
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
Jiang Jiang 2012-01-03 15:35:32 +01:00 committed by Qt by Nokia
parent 07edbd23ed
commit 24e84dd21f

View File

@ -2264,11 +2264,12 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script);
if (mainFontEngine->type() == QFontEngine::Multi) {
QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);
int start = 0;
int end;
int which = glyphLayout.glyphs[0] >> 24;
for (end = 0; end < glyphLayout.numGlyphs; ++end) {
const int e = glyphLayout.glyphs[end] >> 24;
int end = rtl ? glyphLayout.numGlyphs : 0;
int start = rtl ? end : 0;
int which = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
for (; (rtl && start > 0) || (!rtl && end < glyphLayout.numGlyphs);
rtl ? --start : ++end) {
const int e = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
if (e == which)
continue;
@ -2286,7 +2287,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
subLayout.advances_y[i].toReal());
}
start = end;
if (rtl)
end = start;
else
start = end;
which = e;
}