OpenTTD
Data Structures | Typedefs | Functions | Variables
fontcache.h File Reference

Functions to read fonts from files and cache them. More...

#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. More...
 

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...
 

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.

Typedef Documentation

◆ GlyphID

typedef uint32 GlyphID

Glyphs are characters from a font.

Definition at line 19 of file fontcache.h.

Function Documentation

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

References FontCache::fs, and FS_BEGIN.

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

◆ UninitFreeType()

void UninitFreeType ( )

Free everything allocated w.r.t.

fonts.

Definition at line 660 of file fontcache.cpp.

References FontCache::fs, and FS_BEGIN.