OpenTTD Source 20260414-master-g8a7bc482ad
CoreTextFontCacheFactory Class Reference
Inheritance diagram for CoreTextFontCacheFactory:
FontCacheFactory BaseProvider< FontCacheFactory >

Public Member Functions

std::unique_ptr< FontCacheLoadFont (FontSize fs, FontType fonttype, bool search, const std::string &font_name, const std::any &) const override
 Try loading a font with this factory.
bool FindFallbackFont (const std::string &language_isocode, MissingGlyphSearcher *callback) const override
 We would like to have a fallback font as the current one doesn't contain all characters we need.
Public Member Functions inherited from FontCacheFactory
 FontCacheFactory (std::string_view name, std::string_view description)
 ~FontCacheFactory () override
 Unregister this factory.
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.

Static Private Member Functions

static CTFontDescriptorRef LoadFontFromFile (const std::string &font_name)

Static Private Attributes

static CoreTextFontCacheFactory instance

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

Definition at line 199 of file font_osx.cpp.

Constructor & Destructor Documentation

◆ CoreTextFontCacheFactory()

CoreTextFontCacheFactory::CoreTextFontCacheFactory ( )
inline

Definition at line 201 of file font_osx.cpp.

Member Function Documentation

◆ FindFallbackFont()

bool CoreTextFontCacheFactory::FindFallbackFont ( const std::string & language_isocode,
MissingGlyphSearcher * callback ) const
inlineoverridevirtual

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.

Implements FontCacheFactory.

Definition at line 237 of file font_osx.cpp.

References FontCache::AddFallback(), Debug, lengthof, MissingGlyphSearcher::missing_fontsizes, MissingGlyphSearcher::missing_glyphs, Monospace, BaseProvider< FontCacheFactory >::name, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and FontCache::TryFallback().

◆ LoadFont()

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

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.

Implements FontCacheFactory.

Definition at line 203 of file font_osx.cpp.

References GetFontCacheFontSize(), BaseProvider< FontCacheFactory >::name, and TrueType.

◆ LoadFontFromFile()

CTFontDescriptorRef CoreTextFontCacheFactory::LoadFontFromFile ( const std::string & font_name)
inlinestaticprivate

Definition at line 323 of file font_osx.cpp.

Field Documentation

◆ instance

CoreTextFontCacheFactory CoreTextFontCacheFactory::instance
staticprivate

Definition at line 356 of file font_osx.cpp.


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