OpenTTD Source 20260211-master-g04436b7401
CoreTextFontCacheFactory Class Reference
Inheritance diagram for CoreTextFontCacheFactory:
FontCacheFactory BaseProvider< FontCacheFactory >

Public Member Functions

std::unique_ptr< FontCacheLoadFont (FontSize fs, FontType fonttype) const override
 Loads the TrueType font.
bool FindFallbackFont (FontCacheSettings *settings, 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)
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 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
const std::string_view description

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 ( FontCacheSettings * settings,
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.

This function must set all fonts of settings.

Parameters
settingsThe settings to overwrite the fontname of.
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 246 of file font_osx.cpp.

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

◆ LoadFont()

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

Loads the TrueType font.

If a CoreText font description is present, e.g. from the automatic font fallback search, use it. Otherwise, try to resolve it by font name.

Parameters
fsThe font size to load.
fonttypeThe type of font that is being loaded.

Implements FontCacheFactory.

Definition at line 210 of file font_osx.cpp.

References GetFontCacheFontName(), GetFontCacheFontSize(), and TrueType.

◆ LoadFontFromFile()

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

Definition at line 331 of file font_osx.cpp.

Field Documentation

◆ instance

CoreTextFontCacheFactory CoreTextFontCacheFactory::instance
staticprivate

Definition at line 364 of file font_osx.cpp.


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