From: Jiang Jiang Date: Thu, 10 Nov 2011 18:04:14 +0000 (+0100) Subject: Fix symbol fonts support with FT engine X-Git-Tag: qt-v5.0.0-alpha1~2760 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d495d86110c8579253393eadfd83548c49a5cf2f;p=profile%2Fivi%2Fqtbase.git Fix symbol fonts support with FT engine It appears that the symbol_map we obtained with FreeType doesn't work for common symbol fonts like Wingdings, in previous X11 code we use the code path with normal charmap, to enable it we need to make sure QT_NO_FONTCONFIG is not defined. And since the FcCharset functions doesn't really operates on the font database, we can safely skip the mutex calls. Change-Id: I8c484de200be1d47c053b10be2c51d2273dcd359 Reviewed-by: Eskil Abrahamsen Blomfeldt --- diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 6845c67..0747249 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1485,11 +1485,6 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs return false; } -#if !defined(QT_NO_FONTCONFIG) - extern QMutex *qt_fontdatabase_mutex(); - QMutex *mtx = 0; -#endif - bool mirrored = flags & QTextEngine::RightToLeft; int glyph_pos = 0; if (freetype->symbol_map) { @@ -1500,11 +1495,6 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs if ( !glyphs->glyphs[glyph_pos] ) { glyph_t glyph; #if !defined(QT_NO_FONTCONFIG) - if (!mtx) { - mtx = qt_fontdatabase_mutex(); - mtx->lock(); - } - if (freetype->charset != 0 && FcCharSetHasChar(freetype->charset, uc)) { #else if (false) { @@ -1535,11 +1525,6 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0; if (!glyphs->glyphs[glyph_pos]) { #if !defined(QT_NO_FONTCONFIG) - if (!mtx) { - mtx = qt_fontdatabase_mutex(); - mtx->lock(); - } - if (freetype->charset == 0 || FcCharSetHasChar(freetype->charset, uc)) #endif { @@ -1561,11 +1546,6 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs *nglyphs = glyph_pos; glyphs->numGlyphs = glyph_pos; -#if !defined(QT_NO_FONTCONFIG) - if (mtx) - mtx->unlock(); -#endif - if (flags & QTextEngine::GlyphIndicesOnly) return true; diff --git a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri index 2efcb4d..7ea1c64 100644 --- a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri +++ b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri @@ -1,2 +1,3 @@ HEADERS += $$PWD/qfontconfigdatabase_p.h SOURCES += $$PWD/qfontconfigdatabase.cpp +DEFINES -= QT_NO_FONTCONFIG diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 3c37be2..575fbb9 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -503,6 +503,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables:: FcResult result; FcPattern *match = FcFontMatch(0, pattern, &result); + FcCharSet *charset; if (match) { QFontEngineFT::HintStyle default_hint_style; @@ -549,6 +550,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables:: } else format = QFontEngineFT::Format_Mono; + FcPatternGetCharSet(match, FC_CHARSET, 0, &charset); FcPatternDestroy(match); } else format = antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono; @@ -571,6 +573,9 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables:: } } + if (engine && engine->freetype && !engine->freetype->charset) + engine->freetype->charset = FcCharSetCopy(charset); + return engine; }