OpenTTD Source 20241224-master-gf74b0cf984
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 (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.
 

Detailed Description

Functions related to detecting/finding the right font.

Definition in file fontdetection.h.

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_nameThe name of the font to load.
faceThe face that has been found.
Returns
The error we encountered.

Definition at line 42 of file font_unix.cpp.

References SplitFontFamilyAndStyle(), and StrEqualsIgnoreCase().

Referenced by LoadFreeTypeFont().

◆ 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
settingsthe settings to overwrite the fontname of.
language_isocodethe language, e.g. en_GB.
winlangidthe language ID windows style.
callbackThe function to call to check for missing glyphs.
Returns
true if a font has been set, false otherwise.

Definition at line 27 of file font_osx.cpp.

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

Referenced by CheckForMissingGlyphs().