MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / FontStack

Class FontStack

Source/engine/render/text_render.cpp:50–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48};
49
50struct FontStack {
51 OptionalClxSpriteList baseFont;
52 OptionalClxSpriteList overrideFont;
53
54 FontStack() = default;
55
56 explicit FontStack(const OwnedFontStack &owned)
57 {
58 if (owned.baseFont.has_value()) baseFont.emplace(*owned.baseFont);
59 if (owned.overrideFont.has_value()) overrideFont.emplace(*owned.overrideFont);
60 }
61
62 [[nodiscard]] bool has_value() const // NOLINT(readability-identifier-naming)
63 {
64 return baseFont.has_value() || overrideFont.has_value();
65 }
66
67 [[nodiscard]] ClxSprite glyph(size_t i) const
68 {
69 if (overrideFont.has_value()) {
70 ClxSprite overrideGlyph = (*overrideFont)[i];
71 if (overrideGlyph.width() != 0) return overrideGlyph;
72 }
73 return (*baseFont)[i];
74 }
75};
76
77std::unordered_map<uint32_t, OwnedFontStack> Fonts;
78

Callers 1

LoadFontFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected