OpenTTD Source 20260415-master-g3f4984ebaa
font_unix.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 (std::string_view font_name, FT_Face *face)
 Load a freetype font face with the given font name.
bool FontConfigFindFallbackFont (const std::string &language_isocode, MissingGlyphSearcher *callback)
 Use FontConfig to find a fallback font.

Detailed Description

Functions related to detecting/finding the right font.

Definition in file font_unix.h.

Function Documentation

◆ FontConfigFindFallbackFont()

bool FontConfigFindFallbackFont ( const std::string & language_isocode,
MissingGlyphSearcher * callback )

Use FontConfig to find a fallback font.

Parameters
language_isocodeThe language, e.g. en_GB.
callbackThe function to call to check for missing glyphs.
Returns
true if a font has been set, false otherwise.

Definition at line 148 of file font_unix.cpp.

References FontCache::AddFallback(), Debug, FromFcString(), GetPreferredWeightDistance(), MissingGlyphSearcher::missing_fontsizes, MissingGlyphSearcher::missing_glyphs, Monospace, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and ToFcString().

Referenced by FreeTypeFontCacheFactory::FindFallbackFont().

◆ GetFontByFaceName()

FT_Error GetFontByFaceName ( std::string_view font_name,
FT_Face * face )

Load a freetype font face with the given font name.

Parameters
font_nameThe name of the font to load.
faceThe face that has been found.
Returns
The error we encountered.

Definition at line 70 of file font_unix.cpp.

References FromFcString(), SplitFontFamilyAndStyle(), StrEqualsIgnoreCase(), and ToFcString().

Referenced by FreeTypeFontCacheFactory::LoadFont().