OpenTTD Source: FreeTypeFontCacheFactory Class Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Static Private Member Functions | Static Private Attributes
FreeTypeFontCacheFactory Class Reference
Inheritance diagram for FreeTypeFontCacheFactory:

## Public Member Functions
std::unique_ptr< FontCache > | LoadFont (FontSize fs, FontType fonttype) const override
| Loads the freetype font.
bool | FindFallbackFont (struct FontCacheSettings *settings, const std::string &language_isocode, class MissingGlyphSearcher *callback) const 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< FontCache > | LoadFont (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 212 of file freetypefontcache.cpp.

## Constructor & Destructor Documentation

## ◆ FreeTypeFontCacheFactory()

FreeTypeFontCacheFactory::FreeTypeFontCacheFactory | ( |  | ) |
| inline

Definition at line 214 of file freetypefontcache.cpp.

## ◆ ~FreeTypeFontCacheFactory()

virtual FreeTypeFontCacheFactory::~FreeTypeFontCacheFactory | ( |  | ) |
| inlinevirtual

Definition at line 216 of file freetypefontcache.cpp.

## Member Function Documentation

## ◆ FindFallbackFont()

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

Implements FontCacheFactory.

Definition at line 275 of file freetypefontcache.cpp.

## ◆ LoadFont() [1/2]

std::unique_ptr< FontCache > FreeTypeFontCacheFactory::LoadFont | ( | FontSize | fs,
|  | FontType | fonttype
| ) |  | const
| 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

  fs | The font size to load.

Implements FontCacheFactory.

Definition at line 229 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 285 of file freetypefontcache.cpp.

## Field Documentation

## ◆ instance

FreeTypeFontCacheFactory FreeTypeFontCacheFactory::instance
| staticprivate

Definition at line 320 of file freetypefontcache.cpp.

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

- src/fontcache/freetypefontcache.cpp