OpenTTD Source  13.0-beta1
fontcache.h File Reference
#include "string_type.h"
#include "spritecache.h"

Go to the source code of this file.

Data Structures

class  FontCache
 Font cache for basic fonts. More...
 
struct  FontCacheSubSetting
 Settings for a single font. More...
 
struct  FontCacheSettings
 Settings for the four different fonts. More...
 

Typedefs

typedef uint32 GlyphID
 Glyphs are characters from a font.
 

Functions

static void SetUnicodeGlyph (FontSize size, WChar key, SpriteID sprite)
 Map a SpriteID to the font size and key.
 
static void InitializeUnicodeGlyphMap ()
 Initialize the glyph map.
 
static void ClearFontCache ()
 
static const Sprite * GetGlyph (FontSize size, WChar key)
 Get the Sprite for a glyph.
 
static uint GetGlyphWidth (FontSize size, WChar key)
 Get the width of a glyph.
 
static bool GetDrawGlyphShadow (FontSize size)
 
void InitFontCache (bool monospace)
 (Re)initialize the font cache related things, i.e. More...
 
void UninitFontCache ()
 Free everything allocated w.r.t. More...
 
bool HasAntialiasedFonts ()
 Should any of the active fonts be anti-aliased? More...
 
bool GetFontAAState (FontSize size, bool check_blitter=true)
 

Variables

static const GlyphID SPRITE_GLYPH = 1U << 30
 
FontCacheSettings _fcsettings
 

Detailed Description

Functions to read fonts from files and cache them.

Definition in file fontcache.h.

Function Documentation

◆ HasAntialiasedFonts()

bool HasAntialiasedFonts ( )

Should any of the active fonts be anti-aliased?

Returns
True if any of the loaded fonts want anti-aliased drawing.

Definition at line 128 of file fontcache.cpp.

References FS_BEGIN.

◆ InitFontCache()

void InitFontCache ( bool  monospace)

(Re)initialize the font cache related things, i.e.

load the non-sprite fonts.

Parameters
monospaceWhether to initialise the monospace or regular fonts.

Definition at line 87 of file fontcache.cpp.

References FS_BEGIN.

Referenced by MissingGlyphSearcher::FindMissingGlyphs(), and SetFallbackFont().

◆ UninitFontCache()

void UninitFontCache ( )

Free everything allocated w.r.t.

fonts.

Definition at line 111 of file fontcache.cpp.

References FS_BEGIN.