/****************************************************************************** * QSkinny - Copyright (C) 2016 Uwe Rathmann * This file may be used under the terms of the 3-clause BSD License *****************************************************************************/ #include "SkinnyFont.h" #include #include #include #include #include static void foolFontconfig() { // as the examples are always using the same fonts, we can disable // everything, that has to do with system fonts static QTemporaryDir dir; QString fontConfig = "\n" "\n" "\n" "\t%1\n" "\t%2/cache\n" "\n"; fontConfig = fontConfig.arg( dir.path(), dir.path() ); QFile f( dir.path() + "/fonts.conf" ); f.open( QIODevice::WriteOnly ); f.write( fontConfig.toUtf8() ); f.close(); qputenv( "FONTCONFIG_FILE", f.fileName().toUtf8() ); QFontDatabase(); } void SkinnyFont::init( QGuiApplication* ) { foolFontconfig(); QFontDatabase::addApplicationFont( ":/fonts/Roboto-Regular.ttf" ); QFontDatabase::addApplicationFont( ":/fonts/DejaVuSans.ttf" ); /* The default initialization in QskSkin sets up its font table with using the application font for the default font role. */ QGuiApplication::setFont( QFont( "DejaVuSans", 12 ) ); }