QTextEngine: minor clean-up
authorKonstantin Ritt <ritt.ks@gmail.com>
Mon, 21 May 2012 11:21:19 +0000 (14:21 +0300)
committerQt by Nokia <qt-info@nokia.com>
Tue, 22 May 2012 07:17:34 +0000 (09:17 +0200)
Change-Id: I7e21d5cf0130b412f8053b35abdd3420ed006c1c
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
src/gui/text/qtextengine.cpp

index 1694dd5..637fab4 100644 (file)
@@ -2231,7 +2231,7 @@ void QTextEngine::addRequiredBoundaries() const
 bool QTextEngine::atWordSeparator(int position) const
 {
     const QChar c = layoutData->string.at(position);
-    switch (c.toLatin1()) {
+    switch (c.unicode()) {
     case '.':
     case ',':
     case '?':
@@ -2264,19 +2264,24 @@ bool QTextEngine::atWordSeparator(int position) const
     case '|':
         return true;
     default:
-        return false;
+        break;
     }
+    return false;
 }
 
 bool QTextEngine::atSpace(int position) const
 {
     const QChar c = layoutData->string.at(position);
-
-    return c == QLatin1Char(' ')
-        || c == QChar::Nbsp
-        || c == QChar::LineSeparator
-        || c == QLatin1Char('\t')
-        ;
+    switch (c.unicode()) {
+    case QChar::Tabulation:
+    case QChar::Space:
+    case QChar::Nbsp:
+    case QChar::LineSeparator:
+        return true;
+    default:
+        break;
+    }
+    return false;
 }
 
 
@@ -2317,7 +2322,7 @@ static inline bool prevCharJoins(const QString &string, int pos)
     return (joining == QChar::Dual || joining == QChar::Center);
 }
 
-static bool isRetainableControlCode(const QChar &c)
+static inline bool isRetainableControlCode(QChar c)
 {
     return (c.unicode() == 0x202a       // LRE
             || c.unicode() == 0x202b    // LRE