diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-03-03 06:37:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-03 11:11:27 +0100 |
commit | 2b15c9c256e5be597cfc3e8165d9b1a9047cfa7c (patch) | |
tree | 450a3727337fac5f54184a43909d4976dd8547d6 /src/gui/text/qfontengine.cpp | |
parent | af74201edbb9dc344419ed3f8ebc35f8e8f05617 (diff) |
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 <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 61816c83fb..ed758f6f0f 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -385,6 +385,17 @@ bool QFontEngine::supportsScript(QChar::Script script) const return hbFace->supported_scripts[script_to_hbscript(script)]; } +bool QFontEngine::canRender(const QChar *str, int len) const +{ + QStringIterator it(str, str + len); + while (it.hasNext()) { + if (glyphIndex(it.next()) == 0) + return false; + } + + return true; +} + glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix) { glyph_metrics_t metrics = boundingBox(glyph); @@ -1533,7 +1544,7 @@ const char *QFontEngineBox::name() const return "null"; } -bool QFontEngineBox::canRender(const QChar *, int) +bool QFontEngineBox::canRender(const QChar *, int) const { return true; } @@ -1951,7 +1962,7 @@ qreal QFontEngineMulti::minRightBearing() const return engine(0)->minRightBearing(); } -bool QFontEngineMulti::canRender(const QChar *string, int len) +bool QFontEngineMulti::canRender(const QChar *string, int len) const { if (engine(0)->canRender(string, len)) return true; |