QTextEngine: Support SMP code points when case changing

Semi-related to QTBUG-17337

Change-Id: I6b42c0f7e588bbeab27bf410fcdfa1a6f80e4ac2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Konstantin Ritt 2012-10-22 19:27:31 +03:00 committed by The Qt Project
parent f42283669f
commit 38630bc35a

View File

@ -1015,10 +1015,22 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
casedString.resize(entire_shaper_item.item.length); casedString.resize(entire_shaper_item.item.length);
HB_UChar16 *uc = casedString.data(); HB_UChar16 *uc = casedString.data();
for (uint i = 0; i < entire_shaper_item.item.length; ++i) { for (uint i = 0; i < entire_shaper_item.item.length; ++i) {
if(si.analysis.flags == QScriptAnalysis::Lowercase) uint ucs4 = entire_shaper_item.string[si.position + i];
uc[i] = QChar::toLower(entire_shaper_item.string[si.position + i]); if (QChar::isHighSurrogate(ucs4)) {
else uc[i] = ucs4; // high part never changes in simple casing
uc[i] = QChar::toUpper(entire_shaper_item.string[si.position + i]); if (i + 1 < entire_shaper_item.item.length) {
ushort low = entire_shaper_item.string[si.position + i + 1];
if (QChar::isLowSurrogate(low)) {
ucs4 = QChar::surrogateToUcs4(ucs4, low);
ucs4 = si.analysis.flags == QScriptAnalysis::Lowercase ? QChar::toLower(ucs4)
: QChar::toUpper(ucs4);
uc[++i] = QChar::lowSurrogate(ucs4);
}
}
} else {
uc[i] = si.analysis.flags == QScriptAnalysis::Lowercase ? QChar::toLower(ucs4)
: QChar::toUpper(ucs4);
}
} }
entire_shaper_item.item.pos = 0; entire_shaper_item.item.pos = 0;
entire_shaper_item.string = uc; entire_shaper_item.string = uc;