OpenTTD: src/fontdetection.h File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Functions
fontdetection.h File Reference

Functions related to detecting/finding the right font. More...

`#include "fontcache.h"`
`#include <ft2build.h>`
`#include <FT_FREETYPE_H>`

Go to the source code of this file.

## Functions
FT_Error | GetFontByFaceName (const char *font_name, FT_Face *face)
| Load a freetype font face with the given font name.
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.

## Detailed Description

Functions related to detecting/finding the right font.

Definition in file fontdetection.h.

## Function Documentation

FT_Error GetFontByFaceName | ( | const char * | font_name,
|  | FT_Face * | face
| ) |  |

Load a freetype font face with the given font name.

Parameters

  font_name | The name of the font to load.
  face | The face that has been found.

Returns
  The error we encountered.

Load a freetype font face with the given font name.

If no appropriate font is found, the function returns an error

Definition at line 554 of file fontdetection.cpp.

References free(), ShowInfoF(), and stredup().

Referenced by LoadFreeTypeFont().

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 620 of file fontdetection.cpp.

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

Referenced by CheckForMissingGlyphs().