Go to the documentation of this file.
18 static const GlyphID SPRITE_GLYPH = 1U << 30;
120 virtual const void *
GetFontTable(uint32 tag,
size_t &length) = 0;
153 return this->parent !=
nullptr;
176 static inline void ClearFontCache()
197 static inline bool GetDrawGlyphShadow(
FontSize size)
229 default: NOT_REACHED();
241 bool GetFontAAState(
FontSize size,
bool check_blitter =
true);
242 void SetFont(
FontSize fontsize,
const std::string &font, uint size,
bool aa);
uint32 GlyphID
Glyphs are characters from a font.
void UninitFontCache()
Free everything allocated w.r.t.
char32_t WChar
Type for wide characters, i.e.
FontSize GetSize() const
Get the FontSize of the font.
Settings for a single font.
int GetDescender() const
Get the descender value of the font.
int GetHeight() const
Get the height of the font.
int height
The height of the font.
bool aa
Whether to do anti aliasing or not.
@ 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?
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
virtual bool IsBuiltInFont()=0
Is this a built-in sprite font?
int units_per_em
The units per EM value of the font.
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.
FontCacheSubSetting large
The largest font; mostly used for newspapers.
static FontCacheSubSetting * GetFontCacheSubSetting(FontSize fs)
Get the settings of a given font size.
void InitFontCache(bool monospace)
(Re)initialize the font cache related things, i.e.
virtual ~FontCache()
Clean everything up.
FontCacheSubSetting medium
The normal font size.
bool HasAntialiasedFonts()
Should any of the active fonts be anti-aliased?
int GetUnitsPerEM() const
Get the units per EM value of the 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.
static uint GetGlyphWidth(FontSize size, WChar key)
Get the width of a glyph.
int descender
The descender value of the font.
static void SetUnicodeGlyph(FontSize size, WChar key, SpriteID sprite)
Map a SpriteID to the font size and key.
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.
static const Sprite * GetGlyph(FontSize size, WChar key)
Get the Sprite for a glyph.
FontCacheSubSetting mono
The mono space font used for license/readme viewers.
virtual int GetFontSize() const
Get the nominal font size of the font.
virtual const void * GetFontTable(uint32 tag, size_t &length)=0
Read a font table from the font.
int ascender
The ascender value of the font.
const void * os_handle
Optional native OS font info. Only valid during font search.
static void InitializeUnicodeGlyphMap()
Initialize the glyph map.
@ FS_MONO
Index of the monospaced font in the font tables.
virtual void ClearFontCache()=0
Clear the font cache.
FontSize
Available font sizes.
virtual GlyphID MapCharToGlyph(WChar key)=0
Map a character into a glyph.
FontCacheSubSetting small
The smallest font; mostly used for zoomed out view.
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite)=0
Map a SpriteID to the key.
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.