# 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 | ResetFontSizes ()
| Reset the font sizes to the defaults of the sprite based fonts.
void | InitFreeType ()
void | UninitFreeType ()
| Free everything allocated w.r.t.
const Sprite * | GetGlyph (FontSize size, uint32 key)
uint | GetGlyphWidth (FontSize size, uint32 key)
bool | SetFallbackFont (FreeTypeSettings *settings, const char *language_isocode, int winlangid, const char *str)
| 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 ResetFontSizes | ( |  | ) |

Reset the font sizes to the defaults of the sprite based fonts.

Definition at line 1060 of file fontcache.cpp.

References _font_height, FS_LARGE, FS_NORMAL, and FS_SMALL.

Referenced by UninitFreeType().

bool SetFallbackFont | ( | FreeTypeSettings * | settings,
|  | const char * | language_isocode,
|  | int | winlangid,
|  | const char * | str |
| ) |  |  |

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.
  | str | Sample string.

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

Definition at line 662 of file fontcache.cpp.

References lastof, and strecpy().

Referenced by CheckForMissingGlyphsInLoadedLanguagePack().

void UninitFreeType | ( |  | ) |

Free everything allocated w.r.t.

fonts.

Definition at line 848 of file fontcache.cpp.

References ResetFontSizes(), ResetGlyphCache(), and UnloadFace().

Referenced by CheckForMissingGlyphsInLoadedLanguagePack().