mirror-chatterino2/src/fontmanager.hpp

54 lines
935 B
C++
Raw Normal View History

#pragma once
2017-04-12 17:46:44 +02:00
#include <QFont>
#include <QFontMetrics>
2017-04-14 17:52:22 +02:00
namespace chatterino {
2017-04-12 17:46:44 +02:00
class FontManager
{
public:
enum Type : char { Medium, MediumBold, MediumItalic, Small, Large, VeryLarge };
static FontManager &getInstance()
{
return instance;
}
QFont &getFont(Type type);
QFontMetrics &getFontMetrics(Type type);
int getGeneration()
{
return _generation;
}
void incGeneration()
{
_generation++;
}
private:
static FontManager instance;
FontManager();
QFont *_medium;
QFont *_mediumBold;
QFont *_mediumItalic;
QFont *_small;
QFont *_large;
QFont *_veryLarge;
QFontMetrics *_metricsMedium;
QFontMetrics *_metricsMediumBold;
QFontMetrics *_metricsMediumItalic;
QFontMetrics *_metricsSmall;
QFontMetrics *_metricsLarge;
QFontMetrics *_metricsVeryLarge;
int _generation;
};
} // namespace chatterino