OpenTTD Source 20241224-master-gf74b0cf984
font_osx.cpp File Reference

Functions related to font handling on MacOS. More...

#include "../../stdafx.h"
#include "../../debug.h"
#include "font_osx.h"
#include "../../core/math_func.hpp"
#include "../../blitter/factory.hpp"
#include "../../error_func.h"
#include "../../fileio_func.h"
#include "../../fontdetection.h"
#include "../../string_func.h"
#include "../../strings_func.h"
#include "../../zoom_func.h"
#include "macos.h"
#include "../../table/control_codes.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

bool SetFallbackFont (FontCacheSettings *settings, const std::string &language_isocode, int, MissingGlyphSearcher *callback)
 We would like to have a fallback font as the current one doesn't contain all characters we need.
 
static CTFontDescriptorRef LoadFontFromFile (const std::string &font_name)
 
void LoadCoreTextFont (FontSize fs)
 Loads the TrueType font.
 

Detailed Description

Functions related to font handling on MacOS.

Definition in file font_osx.cpp.

Function Documentation

◆ LoadCoreTextFont()

void LoadCoreTextFont ( FontSize  fs)

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.

Definition at line 329 of file font_osx.cpp.

References GetFontCacheFontName(), GetFontCacheFontSize(), GetFontCacheSubSetting(), MacOSVersionIsAtLeast(), and settings.

Referenced by InitFontCache().

◆ LoadFontFromFile()

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

Definition at line 289 of file font_osx.cpp.

◆ SetFallbackFont()

bool SetFallbackFont ( struct FontCacheSettings settings,
const std::string &  language_isocode,
int  winlangid,
class MissingGlyphSearcher callback 
)

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.
winlangidthe language ID windows style.
callbackThe function to call to check for missing glyphs.
Returns
true if a font has been set, false otherwise.

Definition at line 27 of file font_osx.cpp.