summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-01-14 02:48:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-24 11:32:41 +0100
commit717d39ac083e80c2aaf90d38d36345ef92bd57a9 (patch)
treee9da0cc8d8ec5663d021dd746bec349da8e09cf0
parentb87106811e8a087b8c4ee36cd9d7929b57808132 (diff)
Defer HarfBuzz face loading up until it gets used
This didn't work for a loooong time already; not it is possible to re-introduce this optimization once again. Change-Id: I35c40e68933227bda6cbc038c2d8f6709db62451 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/gui/text/qfontengine.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 303c85ce75..8698e5529b 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -267,6 +267,10 @@ void *QFontEngine::harfbuzzFont() const
return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
#endif
if (!font_) {
+ HB_Face hbFace = (HB_Face)harfbuzzFace();
+ if (hbFace->font_for_init != 0)
+ q_check_ptr(qHBLoadFace(hbFace));
+
HB_FontRec *hbFont = (HB_FontRec *) malloc(sizeof(HB_FontRec));
Q_CHECK_PTR(hbFont);
hbFont->klass = &hb_fontClass;
@@ -297,8 +301,6 @@ void *QFontEngine::harfbuzzFace() const
if (!face_) {
HB_Face hbFace = qHBNewFace(const_cast<QFontEngine *>(this), hb_getSFntTable);
Q_CHECK_PTR(hbFace);
- if (hbFace->font_for_init != 0)
- hbFace = qHBLoadFace(hbFace);
hbFace->isSymbolFont = symbol;
face_ = (void *)hbFace;
@@ -338,6 +340,8 @@ bool QFontEngine::supportsScript(QChar::Script script) const
}
#endif
HB_Face hbFace = (HB_Face)harfbuzzFace();
+ if (hbFace->font_for_init != 0)
+ q_check_ptr(qHBLoadFace(hbFace));
return hbFace->supported_scripts[script_to_hbscript(script)];
}