OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
18 static const GlyphID SPRITE_GLYPH = 1U << 30;
127 virtual const void *
GetFontTable(uint32 tag,
size_t &length) = 0;
160 return this->parent !=
nullptr;
189 static inline void ClearFontCache()
210 static inline bool GetDrawGlyphShadow(
FontSize size)
uint32 GlyphID
Glyphs are characters from a font.
virtual SpriteID GetUnicodeGlyph(WChar key)=0
Get the SpriteID mapped to the given key.
char32_t WChar
Type for wide characters, i.e.
FontSize GetSize() const
Get the FontSize of the font.
FreeTypeSubSetting large
The largest font; mostly used for newspapers.
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.
FreeTypeSubSetting mono
The mono space font used for license/readme viewers.
bool aa
Whether to do anti aliasing or not.
int GetAscender() const
Get the ascender value of the font.
const void * os_handle
Optional native OS font info. Only valid during font search.
std::string font
The name of the font, or path to 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?
virtual const char * GetFontName()=0
Get the name of this font.
int units_per_em
The units per EM value of the font.
void InitFreeType(bool monospace)
(Re)initialize the freetype related things, i.e.
bool HasParent()
Check whether the font cache has a parent.
void UninitFreeType()
Free everything allocated w.r.t.
uint size
The (requested) size of the font.
virtual ~FontCache()
Clean everything up.
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.
Font cache for basic fonts.
Settings for a single freetype font.
virtual const Sprite * GetGlyph(GlyphID key)=0
Get the glyph (sprite) of the given key.
FreeTypeSubSetting medium
The normal font size.
FontCache * parent
The parent of this font cache.
static const Sprite * GetGlyph(FontSize size, WChar key)
Get the Sprite for a glyph.
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.
static void InitializeUnicodeGlyphMap()
Initialize the glyph map.
virtual void ClearFontCache()=0
Clear the font cache.
FontSize
Available font sizes.
static SpriteID GetUnicodeGlyph(FontSize size, WChar key)
Get the SpriteID mapped to the given font size and key.
virtual GlyphID MapCharToGlyph(WChar key)=0
Map a character into a glyph.
FreeTypeSubSetting 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.
Settings for the freetype fonts.
static FontCache * Get(FontSize fs)
Get the font cache of a given font size.