summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qrawfont.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-06-10 18:30:10 +0300
committerQt by Nokia <qt-info@nokia.com>2012-06-14 05:22:11 +0200
commit09bc8e2cb8238d8dee79a0f22b26efcc05ce6a52 (patch)
tree29f832231beca539fd6d03261f8e7c18938827db /src/gui/text/qrawfont.cpp
parentdd68e93de7eb1c50cc5b5779497e03f491c90373 (diff)
QFontMetrics/QRawFont: Optimize SMP code points handling a bit
Calling QString::fromUcs4() for the single UCS-4 -encoded character is quite suboptimal since the BOM detections and the resulting QString aren't really used; all we need is to split the UCS-4 code point into the UCS-2 surrogate pair. Change-Id: Ia5b68312909bf551cf2493d9e2752a7d7d837fb9 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/text/qrawfont.cpp')
-rw-r--r--src/gui/text/qrawfont.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 3bd4d88872..ae14f1c798 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -620,17 +620,15 @@ bool QRawFont::supportsCharacter(QChar character) const
}
/*!
+ \overload
+
Returns true if the font has a glyph that corresponds to the UCS-4 encoded character \a ucs4.
\sa supportedWritingSystems()
*/
-bool QRawFont::supportsCharacter(quint32 ucs4) const
+bool QRawFont::supportsCharacter(uint ucs4) const
{
- if (!d->isValid())
- return false;
-
- QString str = QString::fromUcs4(&ucs4, 1);
- return d->fontEngine->canRender(str.constData(), str.size());
+ return d->isValid() && d->fontEngine->canRender(ucs4);
}
// qfontdatabase.cpp