From 2b15c9c256e5be597cfc3e8165d9b1a9047cfa7c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 06:37:29 +0200 Subject: Introduce a generic QFontEngine::canRender() implementation ...which uses the recently introduced glyphIndex() method; get rid of re-implementations that did almost the same. Change-Id: I6d32d2cee6a31f57de6aee05ed8d120d4a1f4e9c Reviewed-by: Lars Knoll --- src/gui/text/qfontengine_p.h | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/gui/text/qfontengine_p.h') diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index f497085ce2..f5e4ae98fa 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -227,19 +227,8 @@ public: virtual const char *name() const = 0; - virtual bool canRender(const QChar *string, int len) = 0; - inline bool canRender(uint ucs4) { - QChar utf16[2]; - int utf16len = 1; - if (QChar::requiresSurrogates(ucs4)) { - utf16[0] = QChar::highSurrogate(ucs4); - utf16[1] = QChar::lowSurrogate(ucs4); - ++utf16len; - } else { - utf16[0] = QChar(ucs4); - } - return canRender(utf16, utf16len); - } + inline bool canRender(uint ucs4) const { return glyphIndex(ucs4) != 0; } + virtual bool canRender(const QChar *str, int len) const; virtual bool supportsTransformation(const QTransform &transform) const; @@ -374,7 +363,7 @@ public: virtual const char *name() const; - virtual bool canRender(const QChar *string, int len); + virtual bool canRender(const QChar *string, int len) const; virtual Type type() const; inline int size() const { return _size; } @@ -421,7 +410,7 @@ public: virtual inline Type type() const { return QFontEngine::Multi; } - virtual bool canRender(const QChar *string, int len); + virtual bool canRender(const QChar *string, int len) const; inline virtual const char *name() const { return "Multi"; } -- cgit v1.2.3