Commit fae6575f authored by Victor Yacovlev's avatar Victor Yacovlev

Fonts included in packaging for HelpViewer

parent 23eba06c
Droid Serif and Droid Sans Mono fonts by Ascender Corporation
http://www.droidfonts.com/droidfonts/
licensed under Apache License, Version 2.0
OpenGost fonts by Nikita Volchenkov and Valek Filippov
https://bitbucket.org/fat_angel/opengostfont
licensed under SIL Open Font License
......@@ -17,6 +17,8 @@ static const QString CodeFontFamily =
static const QString CodeFontSize = "12pt";
bool ContentView::ExtraFontsLoaded_ = false;
ContentView::ContentView(QWidget *parent)
: QTextBrowser(parent)
{
......@@ -26,6 +28,21 @@ ContentView::ContentView(QWidget *parent)
connect(verticalScrollBar(), SIGNAL(sliderMoved(int)),
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;
}
}
QSize ContentView::minimumSizeHint() const
......
......@@ -131,6 +131,8 @@ private /*fields*/:
QUrl lastAnchorUrl_;
bool ignoreClearAnchorUrl_;
static bool ExtraFontsLoaded_;
private slots:
void clearLastAnchorUrl();
void handleInternalLink(const QUrl & url);
......
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