X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fgui%2Ftext%2Fqfontengine_ft.cpp;h=8880eb7cb364221e5569079202304402d153cbc8;hb=933e35ae7e8548ad27c9e85ebfe95ae3eca26619;hp=6845c67463210894cb713cc5d69116570c614355;hpb=63eae1bd15ea8aa1e4fc460194e34ecb5fc55b3a;p=profile%2Fivi%2Fqtbase.git diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 6845c67..8880eb7 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -49,7 +49,7 @@ #ifndef QT_NO_FREETYPE #include "qfile.h" -#include "qabstractfileengine.h" +#include "qfileinfo.h" #include "qthreadstorage.h" #include @@ -205,6 +205,8 @@ HB_Error QFreetypeFace::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 p return HB_Err_Ok; } +extern QByteArray qt_fontdata_from_index(int); + /* * One font file can contain more than one font (bold/italic for example) * find the right one and return it. @@ -229,17 +231,17 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, QScopedPointer newFreetype(new QFreetypeFace); FT_Face face; if (!face_id.filename.isEmpty()) { - QFile file(QString::fromUtf8(face_id.filename)); + QString fileName = QString::fromUtf8(face_id.filename); if (face_id.filename.startsWith(":qmemoryfonts/")) { // from qfontdatabase.cpp - extern QByteArray qt_fontdata_from_index(int); QByteArray idx = face_id.filename; idx.remove(0, 14); // remove ':qmemoryfonts/' bool ok = false; newFreetype->fontData = qt_fontdata_from_index(idx.toInt(&ok)); if (!ok) newFreetype->fontData = QByteArray(); - } else if (!(file.fileEngine()->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::LocalDiskFlag)) { + } else if (!QFileInfo(fileName).isNativePath()) { + QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { return 0; } @@ -1171,8 +1173,7 @@ QFixed QFontEngineFT::ascent() const QFixed QFontEngineFT::descent() const { - // subtract a pixel to work around QFontMetrics's built-in + 1 - return QFixed::fromFixed(-metrics.descender - 64); + return QFixed::fromFixed(-metrics.descender); } QFixed QFontEngineFT::leading() const @@ -1218,6 +1219,7 @@ static const ushort char_table[] = { 88, 89, 91, + 95, 102, 114, 124, @@ -1485,11 +1487,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 +1497,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 +1527,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 +1548,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; @@ -1606,7 +1588,7 @@ glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs) glyph_metrics_t overall; // initialize with line height, we get the same behaviour on all platforms overall.y = -ascent(); - overall.height = ascent() + descent() + 1; + overall.height = ascent() + descent(); QFixed ymax = 0; QFixed xmax = 0; @@ -1915,17 +1897,17 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition) return img; } -QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, int margin, const QTransform &t) +QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t) { if (t.type() > QTransform::TxTranslate) - return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, margin, t); + return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t); lockFace(); Glyph *glyph = loadGlyphFor(g, subPixelPosition, Format_A32); if (!glyph) { unlockFace(); - return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, margin, t); + return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t); } QImage img(glyph->width, glyph->height, QImage::Format_RGB32); @@ -2077,7 +2059,7 @@ bool QFontEngineFT::initFromFontEngine(const QFontEngineFT *fe) QFontEngine *QFontEngineFT::cloneWithSize(qreal pixelSize) const { - QFontDef fontDef; + QFontDef fontDef(this->fontDef); fontDef.pixelSize = pixelSize; QFontEngineFT *fe = new QFontEngineFT(fontDef); if (!fe->initFromFontEngine(this)) {