From 09bc8e2cb8238d8dee79a0f22b26efcc05ce6a52 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 10 Jun 2012 18:30:10 +0300 Subject: 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 --- src/gui/text/qfontmetrics.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/gui/text/qfontmetrics.cpp') diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 83d51e2e71..e5ddcb80d5 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -413,8 +413,7 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const Q_ASSERT(engine != 0); if (engine->type() == QFontEngine::Box) return false; - QString utf16 = QString::fromUcs4(&ucs4, 1); - return engine->canRender(utf16.data(), utf16.length()); + return engine->canRender(ucs4); } /*! @@ -1274,8 +1273,7 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const Q_ASSERT(engine != 0); if (engine->type() == QFontEngine::Box) return false; - QString utf16 = QString::fromUcs4(&ucs4, 1); - return engine->canRender(utf16.data(), utf16.length()); + return engine->canRender(ucs4); } /*! -- cgit v1.2.3