OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
18 static const GlyphID SPRITE_GLYPH = 1U << 30;
34 static void InitializeFontCaches();
142 return this->parent !=
nullptr;
165 inline void ClearFontCache()
186 inline bool GetDrawGlyphShadow(
FontSize size)
219 default: NOT_REACHED();
232 bool GetFontAAState();
233 void SetFont(
FontSize fontsize,
const std::string &font, uint size);
void UninitFontCache()
Free everything allocated w.r.t.
void SetUnicodeGlyph(FontSize size, char32_t key, SpriteID sprite)
Map a SpriteID to the font size and key.
FontSize GetSize() const
Get the FontSize of the font.
const Sprite * GetGlyph(FontSize size, char32_t key)
Get the Sprite for a glyph.
Settings for a single font.
virtual void SetUnicodeGlyph(char32_t key, SpriteID sprite)=0
Map a SpriteID to the key.
int GetDescender() const
Get the descender value of the font.
int GetHeight() const
Get the height of the font.
void InitializeUnicodeGlyphMap()
Initialize the glyph map.
int height
The height of the font.
std::string GetFontCacheFontName(FontSize fs)
Get font to use for a given font size.
@ FS_LARGE
Index of the large font in the font tables.
int GetAscender() const
Get the ascender value of the font.
uint size
The (requested) size of the font.
virtual bool GetDrawGlyphShadow()=0
Do we need to draw a glyph shadow?
virtual bool IsBuiltInFont()=0
Is this a built-in sprite font?
uint GetFontCacheFontSize(FontSize fs)
Get the scalable font size to use for a FontSize.
Settings for the four different fonts.
bool HasParent()
Check whether the font cache has a parent.
@ FS_NORMAL
Index of the normal font in the font tables.
std::string font
The name of the font, or path to the font.
@ FS_SMALL
Index of the small font in the font tables.
uint GetGlyphWidth(FontSize size, char32_t key)
Get the width of a glyph.
FontCacheSubSetting large
The largest font; mostly used for newspapers.
bool prefer_sprite
Whether to prefer the built-in sprite font over resizable fonts.
void InitFontCache(bool monospace)
(Re)initialize the font cache related things, i.e.
virtual ~FontCache()
Clean everything up.
FontCacheSubSetting medium
The normal font size.
FontCacheSubSetting * GetFontCacheSubSetting(FontSize fs)
Get the settings of a given font size.
uint32_t GlyphID
Glyphs are characters from a font.
const FontSize fs
The size of the font.
virtual const void * GetOSHandle()
Get the native OS font handle, if there is one.
virtual uint GetGlyphWidth(GlyphID key)=0
Get the width of the glyph with the given key.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
static std::string GetName(FontSize fs)
Get the font name of a given font size.
int descender
The descender value of the font.
virtual GlyphID MapCharToGlyph(char32_t key, bool fallback=true)=0
Map a character into a glyph.
static FontCache * caches[FS_END]
All the font caches.
virtual std::string GetFontName()=0
Get the name of this font.
Font cache for basic fonts.
virtual const Sprite * GetGlyph(GlyphID key)=0
Get the glyph (sprite) of the given key.
FontCache * parent
The parent of this font cache.
FontCacheSubSetting mono
The mono space font used for license/readme viewers.
virtual int GetFontSize() const
Get the nominal font size of the font.
int ascender
The ascender value of the font.
const void * os_handle
Optional native OS font info. Only valid during font search.
@ FS_MONO
Index of the monospaced font in the font tables.
virtual void ClearFontCache()=0
Clear the font cache.
FontSize
Available font sizes.
bool global_aa
Whether to anti alias all font sizes.
FontCacheSubSetting small
The smallest font; mostly used for zoomed out view.
Data structure describing a sprite.
FontCache(FontSize fs)
Create a new font cache.
virtual void InitializeUnicodeGlyphMap()=0
Initialize the glyph map.
static FontCache * Get(FontSize fs)
Get the font cache of a given font size.