2017-07-21 18:21:34 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the 3-clause BSD License
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "SkinnyFont.h"
|
2018-03-13 20:55:42 +01:00
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
#include <QFontDatabase>
|
2017-07-26 11:56:58 +02:00
|
|
|
#include <QGuiApplication>
|
2018-03-13 20:55:42 +01:00
|
|
|
#include <QElapsedTimer>
|
|
|
|
#include <QDebug>
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-03-13 20:55:42 +01:00
|
|
|
#define STRINGIFY(x) #x
|
|
|
|
#define STRING(x) STRINGIFY(x)
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-03-13 20:55:42 +01:00
|
|
|
void SkinnyFont::init( QGuiApplication* )
|
|
|
|
{
|
|
|
|
#ifdef FONTCONFIG_FILE
|
|
|
|
const char env[] = "FONTCONFIG_FILE";
|
|
|
|
if ( !qEnvironmentVariableIsSet( env ) )
|
|
|
|
qputenv( env, STRING( FONTCONFIG_FILE ) );
|
|
|
|
#endif
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-03-13 20:55:42 +01:00
|
|
|
QElapsedTimer timer;
|
|
|
|
timer.start();
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
QFontDatabase();
|
|
|
|
|
2018-03-13 20:55:42 +01:00
|
|
|
const auto elapsed = timer.elapsed();
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-03-13 20:55:42 +01:00
|
|
|
if ( elapsed > 20 )
|
|
|
|
{
|
2018-03-13 21:07:43 +01:00
|
|
|
qWarning() << "Loading fonts needed" << elapsed << "ms"
|
|
|
|
<< "- usually because of creating a font cache.";
|
2018-03-13 20:55:42 +01:00
|
|
|
}
|
2017-07-26 11:56:58 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
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 ) );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|