summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontenginedirectwrite.cpp
diff options
context:
space:
mode:
authorsuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2011-09-07 11:58:54 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-12 16:03:47 +0200
commit560e68e2bd470e2f4d4353b4100729f15efc666f (patch)
tree5947d87316a1bc893dcf6023ab231a1e862d149b /src/gui/text/qfontenginedirectwrite.cpp
parent338244e9bfd4d0b8b3bec4b4c1620de71e1d5a7a (diff)
Replace explicit surrogate handlers by inline methods of QChar class
Merge-request: 1284 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit 50af55095afe1ba048dde357b771485ef2188778) Change-Id: I0b1967145ad62243afc2060a6ae4ca141a9609fd Reviewed-on: http://codereview.qt-project.org/4587 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/gui/text/qfontenginedirectwrite.cpp')
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index d6932738f5..5bac1172fa 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -269,15 +269,12 @@ QFixed QFontEngineDirectWrite::emSquareSize() const
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;
}
bool QFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,