|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
10 #ifndef SPRITEFONTCACHE_H
11 #define SPRITEFONTCACHE_H
13 #include "../string_func.h"
14 #include "../fontcache.h"
20 SpriteID GetUnicodeGlyph(char32_t key);
32 GlyphID MapCharToGlyph(char32_t key, [[maybe_unused]]
bool allow_fallback =
true)
override { assert(IsPrintable(key));
return SPRITE_GLYPH | key; }
33 const void *
GetFontTable(uint32_t,
size_t &length)
override { length = 0;
return nullptr; }
const Sprite * GetGlyph(GlyphID key) override
Get the glyph (sprite) of the given key.
const void * GetFontTable(uint32_t, size_t &length) override
Read a font table from the font.
uint GetGlyphWidth(GlyphID key) override
Get the width of the glyph with the given key.
void InitializeUnicodeGlyphMap() override
Initialize the glyph map.
Font cache for fonts that are based on a freetype font.
void SetUnicodeGlyph(char32_t key, SpriteID sprite) override
Map a SpriteID to the key.
std::string GetFontName() override
Get the name of this font.
bool GetDrawGlyphShadow() override
Do we need to draw a glyph shadow?
uint32_t GlyphID
Glyphs are characters from a font.
SpriteID ** glyph_to_spriteid_map
Mapping of glyphs to sprite IDs.
const FontSize fs
The size of the font.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
void ClearFontCache() override
Clear the font cache.
Font cache for basic fonts.
~SpriteFontCache()
Free everything we allocated.
void ClearGlyphToSpriteMap()
Clear the glyph to sprite mapping.
FontSize
Available font sizes.
bool IsBuiltInFont() override
Is this a built-in sprite font?
SpriteFontCache(FontSize fs)
Create a new sprite font cache.
Data structure describing a sprite.