OpenTTD Source 20260421-master-gc2fbc6fdeb
FontCacheFactory Class Referenceabstract

Factory for FontCaches. More...

#include <fontcache.h>

Inheritance diagram for FontCacheFactory:
BaseProvider< FontCacheFactory > CoreTextFontCacheFactory FreeTypeFontCacheFactory SpriteFontCacheFactory Win32FontCacheFactory

Public Member Functions

 FontCacheFactory (std::string_view name, std::string_view description)
 ~FontCacheFactory () override
 Unregister this factory.
virtual std::unique_ptr< FontCacheLoadFont (FontSize fs, FontType fonttype, bool search, const std::string &font_name, const std::any &os_handle) const =0
 Try loading a font with this factory.
virtual bool FindFallbackFont (const std::string &language_isocode, class MissingGlyphSearcher *callback) const =0
 We would like to have a fallback font as the current one doesn't contain all characters we need.
Public Member Functions inherited from BaseProvider< FontCacheFactory >
constexpr BaseProvider (std::string_view name, std::string_view description)
 Create the provider.
virtual ~BaseProvider ()=default
 Ensure the destructor of the sub classes are called as well.
std::string_view GetName () const
 Get the name of this provider.
std::string_view GetDescription () const
 Get a description of this provider.

Additional Inherited Members

Protected Attributes inherited from BaseProvider< FontCacheFactory >
const std::string_view name
 The name of the provider.
const std::string_view description
 A description of the provider.

Detailed Description

Factory for FontCaches.

Definition at line 237 of file fontcache.h.

Constructor & Destructor Documentation

◆ FontCacheFactory()

FontCacheFactory::FontCacheFactory ( std::string_view name,
std::string_view description )
inline

Definition at line 239 of file fontcache.h.

◆ ~FontCacheFactory()

FontCacheFactory::~FontCacheFactory ( )
inlineoverride

Unregister this factory.

Definition at line 245 of file fontcache.h.

Member Function Documentation

◆ FindFallbackFont()

virtual bool FontCacheFactory::FindFallbackFont ( const std::string & language_isocode,
class MissingGlyphSearcher * callback ) const
pure virtual

We would like to have a fallback font as the current one doesn't contain all characters we need.

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.

Implemented in CoreTextFontCacheFactory, FreeTypeFontCacheFactory, SpriteFontCacheFactory, and Win32FontCacheFactory.

◆ LoadFont()

virtual std::unique_ptr< FontCache > FontCacheFactory::LoadFont ( FontSize fs,
FontType fonttype,
bool search,
const std::string & font_name,
const std::any & os_handle ) const
pure virtual

Try loading a font with this factory.

Parameters
fsFont size to load.
fonttypeFont type requested.
searchSet if searching for the font.
font_nameFont name to load.
os_handleFont handle to load.
Returns
FontCache of the font if loaded, or nullptr.

Implemented in CoreTextFontCacheFactory, FreeTypeFontCacheFactory, SpriteFontCacheFactory, and Win32FontCacheFactory.


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