Skip to content

Commit

Permalink
creating lib/fonts dir to start the application to skip font error Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
imatefx committed Apr 30, 2014
1 parent 3a3217e commit 4b79182
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
1 change: 0 additions & 1 deletion AppResources.qrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/fonts">
<file>DejaVuSans.ttf</file>
<file>FuturaBookBT.ttf</file>
<file>bitstream.pfb</file>
</qresource>
<qresource prefix="/qt/etc">
Expand Down
2 changes: 0 additions & 2 deletions AutoFileBackup.pro
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ RESOURCES += \

CONFIG += console



RC_FILE = winicon.rc
26 changes: 17 additions & 9 deletions autofilebackup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,35 @@
#include <QDebug>
#include <QFontDatabase>
#include <QTextStream>

#include <QProcess>
QFileSystemWatcher *folderMonitor;
QFileSystemWatcher *fileMonitor;
QList<QString> watchedFiles;
AutoFileBackup::AutoFileBackup(QWidget *parent) : QWidget(parent), ui(new Ui::AutoFileBackup)
{

setWindowIcon(QIcon(":/icons/appicon.ico"));
QString myPath = QCoreApplication::applicationDirPath() + QDir::separator() + "lib" + QDir::separator() + "fonts" ;
QFileInfo fontsdir; (myPath);
fontsdir.dir().mkpath(myPath );

qDebug() << myPath;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", myPath );
env.insert("QT_QPA_FONTDIR", myPath );
setWindowIcon(QIcon(":/icons/appicon.ico"));
// Load the embedded font.
QString fontPath = ":/fonts/DejaVuSans.ttf";
// QFontDatabase::removeAllApplicationFonts();
// QFontDatabase::removeAllApplicationFonts();
int fontId = QFontDatabase::addApplicationFont(fontPath);

QFont font("DejaVu Sans",9);
// font.setStyleName("Regular");
// font.setStyleName("Regular");
this->setFont(font);
qDebug() << fontId ;
qDebug() << QWidget::fontInfo().family();
qDebug() << QWidget::fontInfo().styleName();
qDebug() << QWidget::fontInfo().style();
QFontDatabase db1;
qDebug() << fontId ;
qDebug() << QWidget::fontInfo().family();
qDebug() << QWidget::fontInfo().styleName();
qDebug() << QWidget::fontInfo().style();
QFontDatabase db1;
qDebug() << db1.families();


Expand Down

0 comments on commit 4b79182

Please sign in to comment.