From 6d39e87f340b46637633a34fc32a72c38356473b Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 1 Apr 2014 14:29:38 +0300 Subject: [HB] Ensure we always working with non-multi font engine Change-Id: If88385d4cecdc527b7952d34e48f7ba889173c6c Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 5 +++++ src/gui/text/qharfbuzzng.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index a72ac23418..b2254c4826 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -280,6 +280,7 @@ QFixed QFontEngine::underlinePosition() const void *QFontEngine::harfbuzzFont() const { + Q_ASSERT(type() != QFontEngine::Multi); #ifdef QT_ENABLE_HARFBUZZ_NG if (useHarfbuzzNG) return hb_qt_font_get_for_engine(const_cast(this)); @@ -312,6 +313,7 @@ void *QFontEngine::harfbuzzFont() const void *QFontEngine::harfbuzzFace() const { + Q_ASSERT(type() != QFontEngine::Multi); #ifdef QT_ENABLE_HARFBUZZ_NG if (useHarfbuzzNG) return hb_qt_face_get_for_engine(const_cast(this)); @@ -329,6 +331,9 @@ void *QFontEngine::harfbuzzFace() const bool QFontEngine::supportsScript(QChar::Script script) const { + if (type() <= QFontEngine::Multi) + return true; + // ### TODO: This only works for scripts that require OpenType. More generally // for scripts that do not require OpenType we should just look at the list of // supported writing systems in the font's OS/2 table. diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index b0bade83ee..e87747fd1b 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -605,8 +605,6 @@ _hb_qt_reference_table(hb_face_t * /*face*/, hb_tag_t tag, void *user_data) static inline hb_face_t * _hb_qt_face_create(QFontEngine *fe) { - Q_ASSERT(fe); - QFontEngine::FaceData *data = (QFontEngine::FaceData *)malloc(sizeof(QFontEngine::FaceData)); Q_CHECK_PTR(data); data->user_data = fe->faceData.user_data; @@ -633,6 +631,8 @@ _hb_qt_face_release(void *user_data) hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe) { + Q_ASSERT(fe && fe->type() != QFontEngine::Multi); + if (Q_UNLIKELY(!fe->face_)) { fe->face_ = _hb_qt_face_create(fe); if (Q_UNLIKELY(!fe->face_)) @@ -647,8 +647,6 @@ hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe) static inline hb_font_t * _hb_qt_font_create(QFontEngine *fe) { - Q_ASSERT(fe); - hb_face_t *face = hb_qt_face_get_for_engine(fe); if (Q_UNLIKELY(!face)) return NULL; @@ -685,6 +683,8 @@ _hb_qt_font_release(void *user_data) hb_font_t *hb_qt_font_get_for_engine(QFontEngine *fe) { + Q_ASSERT(fe && fe->type() != QFontEngine::Multi); + if (Q_UNLIKELY(!fe->font_)) { fe->font_ = _hb_qt_font_create(fe); if (Q_UNLIKELY(!fe->font_)) -- cgit v1.2.3