diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2011-09-07 11:58:54 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-09-07 11:58:54 +0200 |
commit | 50af55095afe1ba048dde357b771485ef2188778 (patch) | |
tree | c686d323fdcc1c2f9c64ca3cf6c02f072eb453ee /src/gui/text/qfontengine_qpa.cpp | |
parent | 0f9b98736ceedebece6c9cd4ce2e669300f882c7 (diff) |
Replace explicit surrogate handlers by inline methods of QChar class
Merge-request: 1284
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/gui/text/qfontengine_qpa.cpp')
-rw-r--r-- | src/gui/text/qfontengine_qpa.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index cb1e7d6830..c829c2f875 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -226,15 +226,12 @@ QVariant QFontEngineQPA::extractHeaderField(const uchar *data, HeaderTag request static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) |