mirror-chatterino2/fonts.cpp

65 lines
1.6 KiB
C++
Raw Normal View History

2017-01-05 16:07:20 +01:00
#include "fonts.h"
#define DEFAULT_FONT "Arial"
2017-01-18 21:30:23 +01:00
namespace chatterino {
2017-01-11 18:52:09 +01:00
QFont *Fonts::medium = new QFont(DEFAULT_FONT, 14);
QFont *Fonts::mediumBold = new QFont(DEFAULT_FONT, 14);
QFont *Fonts::mediumItalic = new QFont(DEFAULT_FONT, 14);
2017-01-15 16:38:30 +01:00
QFont *Fonts::small = new QFont(DEFAULT_FONT, 10);
2017-01-11 18:52:09 +01:00
QFont *Fonts::large = new QFont(DEFAULT_FONT, 16);
QFont *Fonts::veryLarge = new QFont(DEFAULT_FONT, 18);
QFontMetrics *Fonts::metricsMedium = new QFontMetrics(*medium);
QFontMetrics *Fonts::metricsMediumBold = new QFontMetrics(*mediumBold);
QFontMetrics *Fonts::metricsMediumItalic = new QFontMetrics(*mediumItalic);
QFontMetrics *Fonts::metricsSmall = new QFontMetrics(*small);
QFontMetrics *Fonts::metricsLarge = new QFontMetrics(*large);
QFontMetrics *Fonts::metricsVeryLarge = new QFontMetrics(*veryLarge);
2017-01-11 01:08:20 +01:00
2017-01-18 04:33:30 +01:00
int Fonts::generation = 0;
2017-01-15 16:38:30 +01:00
2017-01-05 16:07:20 +01:00
Fonts::Fonts()
{
}
2017-01-11 18:52:09 +01:00
QFont &
Fonts::getFont(Type type)
2017-01-05 16:07:20 +01:00
{
2017-01-11 18:52:09 +01:00
if (type == Medium)
return *medium;
if (type == MediumBold)
return *mediumBold;
if (type == MediumItalic)
return *mediumItalic;
if (type == Small)
return *small;
if (type == Large)
return *large;
if (type == VeryLarge)
return *veryLarge;
2017-01-05 16:07:20 +01:00
return *medium;
}
2017-01-11 01:08:20 +01:00
2017-01-11 18:52:09 +01:00
QFontMetrics &
Fonts::getFontMetrics(Type type)
2017-01-11 01:08:20 +01:00
{
2017-01-11 18:52:09 +01:00
if (type == Medium)
return *metricsMedium;
if (type == MediumBold)
return *metricsMediumBold;
if (type == MediumItalic)
return *metricsMediumItalic;
if (type == Small)
return *metricsSmall;
if (type == Large)
return *metricsLarge;
if (type == VeryLarge)
return *metricsVeryLarge;
2017-01-11 01:08:20 +01:00
return *metricsMedium;
}
2017-01-18 21:30:23 +01:00
}