Replace all png icons with a custom font

This commit is contained in:
morg 2023-07-06 17:05:38 +00:00 committed by Adam Honse
parent b8f4b081a4
commit 3256bc3296
65 changed files with 158 additions and 322 deletions

39
qt/OpenRGBFont.cpp Normal file
View file

@ -0,0 +1,39 @@
#include "OpenRGBFont.h"
#include <QFontDatabase>
OpenRGBFont* OpenRGBFont::instance;
OpenRGBFont::OpenRGBFont(){}
OpenRGBFont *OpenRGBFont::Get()
{
if(!instance)
{
instance = new OpenRGBFont();
instance->fontId = QFontDatabase::addApplicationFont(":/fonts/OpenRGB.ttf");
if(instance->fontId == -1)
{
printf("Cannot load requested font.\n");
}
else
{
QString family = QFontDatabase::applicationFontFamilies(instance->fontId).at(0);
instance->font = QFont(family);
instance->font.setStyleStrategy(QFont::PreferAntialias);
}
}
return instance;
}
QString OpenRGBFont::icon(int glyph)
{
return QChar(glyph);
}
QFont OpenRGBFont::GetFont()
{
return Get()->font;
}