OpenTTD Source: src/os/unix/font_unix.cpp File Reference

OpenTTD Source 14.0-beta1

Functions | Variables
font_unix.cpp File Reference
`#include "../../stdafx.h"`
`#include "../../debug.h"`
`#include "../../fontdetection.h"`
`#include "../../string_func.h"`
`#include "../../strings_func.h"`
`#include <fontconfig/fontconfig.h>`
`#include "safeguards.h"`
`#include <ft2build.h>`
`#include <FT_FREETYPE_H>`

Go to the source code of this file.

## Functions
static std::tuple< std::string, std::string > | SplitFontFamilyAndStyle (std::string_view font_name)
| Split the font name into the font family and style. More...
FT_Error | GetFontByFaceName (const char *font_name, FT_Face *face)
| Load a freetype font face with the given font name. More...
bool | SetFallbackFont (FontCacheSettings *settings, const std::string &language_isocode, int, MissingGlyphSearcher *callback)
| We would like to have a fallback font as the current one doesn't contain all characters we need. More...

## Variables
FT_Library | _library

## Detailed Description

Functions related to font handling on Unix/Fontconfig.

Definition in file font_unix.cpp.

## Function Documentation

## ◆ GetFontByFaceName()

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.

Definition at line 42 of file font_unix.cpp.

## ◆ SetFallbackFont()

bool SetFallbackFont | ( | struct FontCacheSettings * | settings,
|  | const std::string & | 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 100 of file font_unix.cpp.

References Debug, MissingGlyphSearcher::FindMissingGlyphs(), InitFontCache(), MissingGlyphSearcher::Monospace(), MissingGlyphSearcher::SetFontNames(), and settings.

## ◆ SplitFontFamilyAndStyle()

static std::tuple<std::string, std::string> SplitFontFamilyAndStyle | ( | std::string_view | font_name | ) |
| static

Split the font name into the font family and style.

These fields are separated by a comma, but the style does not necessarily need to exist.

Parameters

  font_name | The font name.

Returns
  The font family and style.

Definition at line 31 of file font_unix.cpp.