QFreetypeFace: Fix getFace() uses UTF-8 paths on non UTF-8 locales
QFontEngine::FaceId::filename is intended to be local8Bit-encoded but QFreetypeFace::getFace() always treats it like UTF-8-encoded. Also replace explicit (to|from)Local8Bit and toLatin FaceId::filename conversions with QFile::(en|de)codeName, where appropriate. Change-Id: Ic7beabf0a160f2f02f1667bcb8e6067adaba1c16 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>bb10
parent
9f7bc42b7d
commit
c0300eed19
|
|
@ -232,7 +232,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
|
|||
QScopedPointer<QFreetypeFace> newFreetype(new QFreetypeFace);
|
||||
FT_Face face;
|
||||
if (!face_id.filename.isEmpty()) {
|
||||
QString fileName = QString::fromUtf8(face_id.filename);
|
||||
QString fileName = QFile::decodeName(face_id.filename);
|
||||
if (face_id.filename.startsWith(":qmemoryfonts/")) {
|
||||
// from qfontdatabase.cpp
|
||||
QByteArray idx = face_id.filename;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, QChar::Scri
|
|||
QFontEngineFT *engine;
|
||||
FontFile *fontfile = static_cast<FontFile *> (usrPtr);
|
||||
QFontEngine::FaceId fid;
|
||||
fid.filename = fontfile->fileName.toLocal8Bit();
|
||||
fid.filename = QFile::encodeName(fontfile->fileName);
|
||||
fid.index = fontfile->indexValue;
|
||||
engine = new QFontEngineFT(fontDef);
|
||||
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ static bool isSymbolFont(FontFile *fontFile)
|
|||
return false;
|
||||
|
||||
QFontEngine::FaceId id;
|
||||
id.filename = fontFile->fileName.toLocal8Bit();
|
||||
id.filename = QFile::encodeName(fontFile->fileName);
|
||||
id.index = fontFile->indexValue;
|
||||
|
||||
QFreetypeFace *f = QFreetypeFace::getFace(id);
|
||||
|
|
@ -567,7 +567,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc
|
|||
QFontEngineFT *engine;
|
||||
FontFile *fontfile = static_cast<FontFile *> (usrPtr);
|
||||
QFontEngine::FaceId fid;
|
||||
fid.filename = fontfile->fileName.toLocal8Bit();
|
||||
fid.filename = QFile::encodeName(fontfile->fileName);
|
||||
fid.index = fontfile->indexValue;
|
||||
|
||||
bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
|
|||
return false;
|
||||
|
||||
if (!QDir::isAbsolutePath(value))
|
||||
value.prepend(QString::fromLocal8Bit(qgetenv("windir") + "\\Fonts\\"));
|
||||
value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\"));
|
||||
|
||||
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch,
|
||||
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ void QWindowsFontEngine::getCMap()
|
|||
unitsPerEm = otm->otmEMSquare;
|
||||
x_height = (int)otm->otmsXHeight;
|
||||
loadKerningPairs(designToDevice);
|
||||
_faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1();
|
||||
_faceId.filename = QFile::encodeName(QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)));
|
||||
lineWidth = otm->otmsUnderscoreSize;
|
||||
fsType = otm->otmfsType;
|
||||
free(otm);
|
||||
|
|
|
|||
Loading…
Reference in New Issue