OpenTTD Source 20250723-master-gae917cb8c6
|
Functions related to font handling on Unix/Fontconfig. More...
#include "../../stdafx.h"
#include "../../misc/autorelease.hpp"
#include "../../debug.h"
#include "../../fontdetection.h"
#include "../../string_func.h"
#include "../../strings_func.h"
#include <fontconfig/fontconfig.h>
#include "../../safeguards.h"
#include <ft2build.h>
#include <FT_FREETYPE_H>
Go to the source code of this file.
Functions | |
static const FcChar8 * | ToFcString (const std::string &str) |
Get a FontConfig-style string from a std::string. | |
static const char * | FromFcString (const FcChar8 *str) |
Get a C-style string from a FontConfig-style string. | |
static std::tuple< std::string, std::string > | SplitFontFamilyAndStyle (std::string_view font_name) |
Split the font name into the font family and style. | |
FT_Error | GetFontByFaceName (std::string_view font_name, FT_Face *face) |
Load a freetype font face with the given font name. | |
bool | SetFallbackFont (FontCacheSettings *settings, const std::string &language_isocode, MissingGlyphSearcher *callback) |
We would like to have a fallback font as the current one doesn't contain all characters we need. | |
Variables | |
FT_Library | _ft_library |
Functions related to font handling on Unix/Fontconfig.
Definition in file font_unix.cpp.
|
static |
Get a C-style string from a FontConfig-style string.
str | String from FontConfig. |
Definition at line 42 of file font_unix.cpp.
Referenced by GetFontByFaceName(), and SetFallbackFont().
FT_Error GetFontByFaceName | ( | std::string_view | font_name, |
FT_Face * | face | ||
) |
Load a freetype font face with the given font name.
font_name | The name of the font to load. |
face | The face that has been found. |
Definition at line 64 of file font_unix.cpp.
References FromFcString(), SplitFontFamilyAndStyle(), StrEqualsIgnoreCase(), and ToFcString().
Referenced by LoadFreeTypeFont().
bool SetFallbackFont | ( | struct FontCacheSettings * | settings, |
const std::string & | language_isocode, | ||
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.
settings | the settings to overwrite the fontname of. |
language_isocode | the language, e.g. en_GB. |
callback | The function to call to check for missing glyphs. |
Definition at line 120 of file font_unix.cpp.
References Debug, MissingGlyphSearcher::FindMissingGlyphs(), FONTSIZES_REQUIRED, FromFcString(), InitFontCache(), MissingGlyphSearcher::Monospace(), MissingGlyphSearcher::SetFontNames(), settings, and ToFcString().
|
static |
Split the font name into the font family and style.
These fields are separated by a comma, but the style does not necessarily need to exist.
font_name | The font name. |
Definition at line 53 of file font_unix.cpp.
Referenced by GetFontByFaceName().
|
static |
Get a FontConfig-style string from a std::string.
str | String to be passed to FontConfig. |
Definition at line 32 of file font_unix.cpp.
Referenced by GetFontByFaceName(), and SetFallbackFont().
|
extern |
Definition at line 49 of file freetypefontcache.cpp.