diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-03-06 12:02:25 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-10 15:05:01 +0100 |
commit | 11eb9d37dc191b6e71c903e4f7f4d2da579e7df5 (patch) | |
tree | f2f5695fe82251000b969410bb4860a5ffdecc0d /src/gui/text/qfontengine.cpp | |
parent | ca280bfe3bc551f814d59d25079e098798fbdad7 (diff) |
Use QStringIterator instead of homebrew
Task-number: QTBUG-15664
Change-Id: I1ed3eb04ddd822e57a4d993af656dfe283f3af1a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index c6674a1b12..a72ac23418 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1594,10 +1594,10 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); int glyph_pos = 0; - for (int i = 0; i < len; ++i) { - bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); - uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode(); - if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { + QStringIterator it(str, str + len); + while (it.hasNext()) { + const uint ucs4 = it.peekNext(); + if (glyphs->glyphs[glyph_pos] == 0 && ucs4 != QChar::LineSeparator) { for (int x = 1, n = qMin(engines.size(), 256); x < n; ++x) { if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4)) continue; @@ -1625,8 +1625,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, } } - if (surrogate) - ++i; + it.advance(); ++glyph_pos; } |