FlowArithmeticCalculator 1.0.0
Flow Arithmetic Calculator
Loading...
Searching...
No Matches
FontManager.h
Go to the documentation of this file.
1#ifndef FONT_MANAGER_H
2#define FONT_MANAGER_H
3
4#include <skia/include/core/SkFont.h>
5#include <skia/include/core/SkFontMgr.h>
6#include <skia/include/core/SkPaint.h>
7#include <skia/include/core/SkSurface.h>
8#include <skia/include/core/SkTypeface.h>
9
11#include "colors.h"
12#include "constants.h"
13
14#ifdef __APPLE__
15#include <skia/include/ports/SkFontMgr_mac_ct.h>
16#elif defined(__linux__)
17// linux - use fontconfig
18#include <skia/include/ports/SkFontMgr_fontconfig.h>
19#include <skia/include/ports/SkFontScanner_FreeType.h>
20#else
21// windows
22#include <skia/include/ports/SkTypeface_win.h>
23#endif
24
28namespace gui::renderer {
29 // using an empty namespace to avoid polluting the outer scope of business_logic::elements::base
30 namespace {
31 namespace colors = gui::renderer::colors;
32 }
33
39 public:
43 static SkPaint textFontFillPaint;
44
48 static SkPaint textFontStrokePaint;
49
53 static SkFont menuChoiceFont;
54
58 static SkFont menuHeadlineFont;
59
63 static SkFont menuCaptionFont;
64
68 static SkFont captionFont;
69
86 static void recalculateFontSizes(float aspectX, float aspectY, float xScale, float yScale);
87
93 static const SkFont& getFontForVariant(
95
96 private:
100 static sk_sp<SkTypeface> typeface;
101
105 static sk_sp<SkFontMgr> fontMgr;
106 };
107} // namespace gui::renderer
108
109#endif // FONT_MANAGER_H
Variant
The visual display variant of the text.
Definition UIText.h:19
Utility class that holds static font instances and handles scaling them on window resizes.
Definition FontManager.h:38
static void recalculateFontSizes(float aspectX, float aspectY, float xScale, float yScale)
Recalculates the font sizes.
static sk_sp< SkTypeface > typeface
The typeface for the text font.
static SkFont menuHeadlineFont
The font for the menu headline font.
Definition FontManager.h:58
static sk_sp< SkFontMgr > fontMgr
The font manager.
static SkPaint textFontFillPaint
The paint for the text font fill.
Definition FontManager.h:43
static SkFont menuCaptionFont
The font for the menu caption font.
Definition FontManager.h:63
static const SkFont & getFontForVariant(const business_logic::components::UIText::Variant &variant)
Gets the font for the given variant.
static SkPaint textFontStrokePaint
The paint for the text font stroke.
Definition FontManager.h:48
static SkFont captionFont
The font for the caption font.
Definition FontManager.h:68
static SkFont menuChoiceFont
The font for the menu choice font.
Definition FontManager.h:53
Color constants used for rendering entities.
Definition colors.cpp:3
The GUI renderer and renderer-supporting implementation module.
Definition colors.cpp:3