-
-
Notifications
You must be signed in to change notification settings - Fork 144
/
redasmfonts.h
48 lines (40 loc) · 1.5 KB
/
redasmfonts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include <QIconEngine>
#include <QFont>
class REDasmFontIconEngine: public QIconEngine
{
public:
REDasmFontIconEngine();
void setFont(const QFont& font);
void setLetter(const QString& letter);
void setColor(const QColor& color);
public:
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State) override;
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
QIconEngine* clone() const override;
private:
QFont m_font;
QString m_letter;
QColor m_color;
};
class REDasmFonts
{
private:
REDasmFonts();
public:
QFont faFont() const;
QFont faBrandsFont() const;
QIcon icon(const QChar& code, const QColor& color);
QIcon icon(const QChar& code);
QIcon brand(const QChar& code, const QColor& color);
QIcon brand(const QChar& code);
static REDasmFonts* instance();
private:
QStringList m_fafamilies, m_fabfamilies;
};
#define FA_FONT REDasmFonts::instance()->faFont()
#define FAB_FONT REDasmFonts::instance()->faBrandsFont()
#define FA_ICON(code) REDasmFonts::instance()->icon(QChar{code})
#define FA_ICON_COLOR(code, color) REDasmFonts::instance()->icon(QChar{code}, color)
#define FAB_ICON(code) REDasmFonts::instance()->brand(QChar{code})
#define FAB_ICON_COLOR(code, color) REDasmFonts::instance()->brand(QChar{code}, color)