OpenTTD Source 20250905-master-g122023be8d
FreeTypeFontCacheFactory Class Reference
Inheritance diagram for FreeTypeFontCacheFactory:
FontCacheFactory BaseProvider< FontCacheFactory >

Public Member Functions

std::unique_ptr< FontCacheLoadFont (FontSize fs, FontType fonttype) override
 Loads the freetype font.
 
bool FindFallbackFont (struct FontCacheSettings *settings, const std::string &language_isocode, class MissingGlyphSearcher *callback) override
 
- Public Member Functions inherited from FontCacheFactory
 FontCacheFactory (std::string_view name, std::string_view description)
 
- Public Member Functions inherited from BaseProvider< FontCacheFactory >
constexpr BaseProvider (std::string_view name, std::string_view description)
 
std::string_view GetName () const
 
std::string_view GetDescription () const
 

Static Private Member Functions

static std::unique_ptr< FontCacheLoadFont (FontSize fs, FT_Face face, std::string_view font_name, uint size)
 

Static Private Attributes

static FreeTypeFontCacheFactory instance
 

Additional Inherited Members

- Protected Attributes inherited from BaseProvider< FontCacheFactory >
const std::string_view name
 
const std::string_view description
 

Detailed Description

Definition at line 211 of file freetypefontcache.cpp.

Constructor & Destructor Documentation

◆ FreeTypeFontCacheFactory()

FreeTypeFontCacheFactory::FreeTypeFontCacheFactory ( )
inline

Definition at line 213 of file freetypefontcache.cpp.

◆ ~FreeTypeFontCacheFactory()

virtual FreeTypeFontCacheFactory::~FreeTypeFontCacheFactory ( )
inlinevirtual

Definition at line 215 of file freetypefontcache.cpp.

Member Function Documentation

◆ FindFallbackFont()

bool FreeTypeFontCacheFactory::FindFallbackFont ( struct FontCacheSettings settings,
const std::string &  language_isocode,
class MissingGlyphSearcher callback 
)
inlineoverridevirtual

Implements FontCacheFactory.

Definition at line 274 of file freetypefontcache.cpp.

◆ LoadFont() [1/2]

std::unique_ptr< FontCache > FreeTypeFontCacheFactory::LoadFont ( FontSize  fs,
FontType  fonttype 
)
inlineoverridevirtual

Loads the freetype font.

First try to load the fontname as if it were a path. If that fails, try to resolve the filename of the font using fontconfig, where the format is 'font family name' or 'font family name, font style'.

Parameters
fsThe font size to load.

Implements FontCacheFactory.

Definition at line 228 of file freetypefontcache.cpp.

References BASE_DIR, Debug, FioFindFullPath(), GetFontByFaceName(), GetFontCacheFontName(), GetFontCacheFontSize(), GetFontCacheSubSetting(), LoadFont(), settings, and TrueType.

Referenced by LoadFont().

◆ LoadFont() [2/2]

static std::unique_ptr< FontCache > FreeTypeFontCacheFactory::LoadFont ( FontSize  fs,
FT_Face  face,
std::string_view  font_name,
uint  size 
)
inlinestaticprivate

Definition at line 284 of file freetypefontcache.cpp.

Field Documentation

◆ instance

FreeTypeFontCacheFactory FreeTypeFontCacheFactory::instance
staticprivate

Definition at line 319 of file freetypefontcache.cpp.


The documentation for this class was generated from the following file: