From: Stefan Bund Date: Mon, 1 Nov 2010 22:10:06 +0000 (+0100) Subject: Add font directory support X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=5226cc819a82f279d8bcb512a5910030be265d38;p=pykit.git Add font directory support --- diff --git a/main.cc b/main.cc index fcebd20..023e143 100644 --- a/main.cc +++ b/main.cc @@ -15,6 +15,9 @@ #include #include #include +#include +#include +#include #include #include "MainWindow.hh" #include "PythonPublisher.hh" @@ -48,6 +51,22 @@ int main(int argc, char *argv[]) QString iconPath (settings.value("icon").toString()); settings.endGroup(); + + settings.beginGroup("Fonts"); + QString loadFontDir (settings.value("loaddir").toString()); + if (!loadFontDir.isEmpty()) { + QDir dir (loadFontDir); + if (dir.exists()) { + QFileInfoList files (dir.entryInfoList(QDir::Files)); + for (QFileInfoList::iterator i (files.begin()), i_end (files.end()); + i != i_end; ++i) + QFontDatabase::addApplicationFont(i->absoluteFilePath()); + } + else + std::cerr << "WARNING: Font directory not found" << std::endl; + } + settings.endGroup(); + settings.beginGroup("Viewer"); pykit::PythonPublisher publisher (settings.value("init").toString().toStdString());