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 <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
Jiang Jiang 2011-11-10 19:04:14 +01:00 committed by Qt by Nokia
parent 89cfe9eb01
commit d495d86110
3 changed files with 6 additions and 20 deletions

View File

@ -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;

View File

@ -1,2 +1,3 @@
HEADERS += $$PWD/qfontconfigdatabase_p.h
SOURCES += $$PWD/qfontconfigdatabase.cpp
DEFINES -= QT_NO_FONTCONFIG

View File

@ -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;
}