MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / getGlyph

Method getGlyph

framework/font.cpp:73–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73sp<PaletteImage> BitmapFont::getGlyph(char32_t codepoint)
74{
75 if (fontbitmaps.find(codepoint) == fontbitmaps.end())
76 {
77 // FIXME: Hack - assume all missing glyphs are spaces
78 // TODO: Fallback fonts?
79 LogWarning("Font %s missing glyph for character \"%s\" (codepoint %u)", this->getName(),
80 to_ustring(std::u32string(1, codepoint)), static_cast<uint32_t>(codepoint));
81 auto missingGlyph = this->getGlyph(to_char32(' '));
82 fontbitmaps.emplace(codepoint, missingGlyph);
83 }
84 return fontbitmaps[codepoint];
85}
86
87sp<Palette> BitmapFont::getPalette() const { return this->palette; }
88

Callers 2

getStringMethod · 0.95
getFontWidthMethod · 0.95

Calls 4

getNameMethod · 0.95
to_ustringFunction · 0.85
to_char32Function · 0.85
endMethod · 0.80

Tested by

no test coverage detected