diff options
-rw-r--r-- | src/declarative/util/qmlfontloader.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/declarative/util/qmlfontloader.cpp b/src/declarative/util/qmlfontloader.cpp index 42b34b5..b56043b 100644 --- a/src/declarative/util/qmlfontloader.cpp +++ b/src/declarative/util/qmlfontloader.cpp @@ -126,10 +126,16 @@ void QmlFontLoader::setSource(const QUrl &url) #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML QString lf = toLocalFileOrQrc(d->url); if (!lf.isEmpty()) { - QFile file(lf); - file.open(QIODevice::ReadOnly); - QByteArray ba = file.readAll(); - d->addFontToDatabase(ba); + int id = QFontDatabase::addApplicationFont(lf); + if (id != -1) { + d->name = QFontDatabase::applicationFontFamilies(id).at(0); + emit nameChanged(); + d->status = QmlFontLoader::Ready; + } else { + d->status = QmlFontLoader::Error; + qWarning() << "Cannot load font:" << url; + } + emit statusChanged(); } else #endif { |