Commit 81e07857 authored by Victor Yacovlev's avatar Victor Yacovlev

Performance fix on load extra fonts for DocBookViewer

parent 7ad4b78a
......@@ -33,19 +33,19 @@ ContentView::ContentView(QWidget *parent)
this, SLOT(clearLastAnchorUrl()));
ignoreClearAnchorUrl_ = false;
if (!ExtraFontsLoaded_) {
const QString resourcesRoot = QCoreApplication::instance()->property("sharePath").toString();
const QDir fontsDir = QDir(resourcesRoot + "/docbookviewer");
const QStringList ttfFiles = fontsDir.entryList(QStringList() << "*.ttf" << "*.otf");
foreach (const QString & fileName, ttfFiles) {
const QString filePath = fontsDir.absoluteFilePath(fileName);
int id = QFontDatabase::addApplicationFont(filePath);
if (id == -1) {
qWarning() << "Can't load font " << filePath;
}
}
ExtraFontsLoaded_ = true;
}
// if (!ExtraFontsLoaded_) {
// const QString resourcesRoot = QCoreApplication::instance()->property("sharePath").toString();
// const QDir fontsDir = QDir(resourcesRoot + "/docbookviewer");
// const QStringList ttfFiles = fontsDir.entryList(QStringList() << "*.ttf" << "*.otf");
// foreach (const QString & fileName, ttfFiles) {
// const QString filePath = fontsDir.absoluteFilePath(fileName);
// int id = QFontDatabase::addApplicationFont(filePath);
// if (id == -1) {
// qWarning() << "Can't load font " << filePath;
// }
// }
// ExtraFontsLoaded_ = true;
// }
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment