OpenTTD Source  1.11.2
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  FreeTypeSubSetting
 Settings for a single freetype font. More...
 
struct  FreeTypeSettings
 Settings for the freetype fonts. More...
 

Typedefs

typedef uint32 GlyphID
 Glyphs are characters from a font.
 

Functions

static SpriteID GetUnicodeGlyph (FontSize size, WChar key)
 Get the SpriteID mapped to the given font size and key.
 
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 SpriteGetGlyph (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 InitFreeType (bool monospace)
 (Re)initialize the freetype related things, i.e. More...
 
void UninitFreeType ()
 Free everything allocated w.r.t. More...
 
bool HasAntialiasedFonts ()
 Should any of the active fonts be anti-aliased? More...
 

Variables

static const GlyphID SPRITE_GLYPH = 1U << 30
 
FreeTypeSettings _freetype
 

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 723 of file fontcache.cpp.

References FS_BEGIN.

◆ InitFreeType()

void InitFreeType ( bool  monospace)

(Re)initialize the freetype related things, i.e.

load the non-sprite fonts.

Parameters
monospaceWhether to initialise the monospace or regular fonts.

Definition at line 683 of file fontcache.cpp.

References FS_BEGIN.

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

◆ UninitFreeType()

void UninitFreeType ( )

Free everything allocated w.r.t.

fonts.

Definition at line 706 of file fontcache.cpp.

References FS_BEGIN.