Revert "Don't render glyph with FT with fetchMetricsOnly"
[profile/ivi/qtbase.git] / src / gui / text / qfontengine_ft.cpp
index ca1d6bb..8880eb7 100644 (file)
@@ -49,7 +49,7 @@
 #ifndef QT_NO_FREETYPE
 
 #include "qfile.h"
-#include "qabstractfileengine.h"
+#include "qfileinfo.h"
 #include "qthreadstorage.h"
 #include <qmath.h>
 
@@ -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<QFreetypeFace> 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
@@ -1587,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;