Data Structures | Functions | Variables

# fontcache.h File Reference

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

`#include "spritecache.h"`

Go to the source code of this file.

## Data Structures
struct | FreeTypeSettings
## Functions
SpriteID | GetUnicodeGlyph (FontSize size, uint32 key)
| Get the SpriteID mapped to the given font size and key.
void | SetUnicodeGlyph (FontSize size, uint32 key, SpriteID sprite)
| Map a SpriteID to the font size and key.
void | InitializeUnicodeGlyphMap ()
| Initialize the glyph map.
void | InitFreeType (bool monospace)
| (Re)initialize the freetype related things, i.e.
void | UninitFreeType ()
| Free everything allocated w.r.t.
void | ClearFontCache ()
| Reset cached glyphs.
const Sprite * | GetGlyph (FontSize size, uint32 key)
uint | GetGlyphWidth (FontSize size, uint32 key)
bool | GetDrawGlyphShadow ()
bool | SetFallbackFont (FreeTypeSettings *settings, const char *language_isocode, int winlangid, class MissingGlyphSearcher *callback)
| We would like to have a fallback font as the current one doesn't contain all characters we need.
## Variables
FreeTypeSettings | _freetype

## Detailed Description

Functions to read fonts from files and cache them.

Definition in file fontcache.h.

## Function Documentation

void InitFreeType | ( | bool | monospace | ) |

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

load the non-sprite fonts.

Parameters:

  | monospace | Whether to initialise the monospace or regular fonts.

Definition at line 908 of file fontcache.cpp.

References DEBUG, FS_LARGE, FS_MONO, FS_NORMAL, FS_SMALL, LoadFreeTypeFont(), ResetFontSizes(), ResetGlyphCache(), ShowInfoF(), StrEmpty(), and UnloadFace().

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

bool SetFallbackFont | ( | FreeTypeSettings * | settings,
|  | const char * | language_isocode,
|  | int | winlangid,
|  | class MissingGlyphSearcher * | callback |
| ) |  |  |

We would like to have a fallback font as the current one doesn't contain all characters we need.

This function must set all fonts of settings.

Parameters:

  | settings | the settings to overwrite the fontname of.
  | language_isocode | the language, e.g. en_GB.
  | winlangid | the language ID windows style.
  | callback | The function to call to check for missing glyphs.

Returns:
  true if a font has been set, false otherwise.

Definition at line 735 of file fontcache.cpp.

References DEBUG, MissingGlyphSearcher::FindMissingGlyphs(), InitFreeType(), lastof, MissingGlyphSearcher::Monospace(), seprintf(), and MissingGlyphSearcher::SetFontNames().

Referenced by CheckForMissingGlyphs().

void UninitFreeType | ( |  | ) |

Free everything allocated w.r.t.

fonts.

Definition at line 963 of file fontcache.cpp.

References ResetGlyphCache(), and UnloadFace().

Referenced by ShutdownGame().