OpenTTD Source 20241224-master-gee860a5c8e
freetypefontcache.cpp File Reference

FreeType font cache implementation. More...

#include "../stdafx.h"
#include "../debug.h"
#include "../fontcache.h"
#include "../fontdetection.h"
#include "../blitter/factory.hpp"
#include "../core/math_func.hpp"
#include "../zoom_func.h"
#include "../fileio_func.h"
#include "../error_func.h"
#include "truetypefontcache.h"
#include "../table/control_codes.h"
#include "../safeguards.h"
#include <ft2build.h>
#include <FT_FREETYPE_H>
#include <FT_GLYPH_H>
#include <FT_TRUETYPE_TABLES_H>

Go to the source code of this file.

Data Structures

class  FreeTypeFontCache
 Font cache for fonts that are based on a freetype font. More...
 

Functions

static FT_Error LoadFont (FontSize fs, FT_Face face, const char *font_name, uint size)
 
void LoadFreeTypeFont (FontSize fs)
 Loads the freetype font.
 
void UninitFreeType ()
 Free everything allocated w.r.t.
 

Variables

FT_Library _library = nullptr
 

Detailed Description

FreeType font cache implementation.

Definition in file freetypefontcache.cpp.

Function Documentation

◆ LoadFont()

static FT_Error LoadFont ( FontSize  fs,
FT_Face  face,
const char *  font_name,
uint  size 
)
static

Definition at line 116 of file freetypefontcache.cpp.

◆ LoadFreeTypeFont()

void LoadFreeTypeFont ( FontSize  fs)

Loads the freetype font.

First type 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
fsThe font size to load.

Definition at line 159 of file freetypefontcache.cpp.

References BASE_DIR, Debug, FioFindFullPath(), GetFontByFaceName(), GetFontCacheFontName(), GetFontCacheFontSize(), GetFontCacheSubSetting(), and settings.

Referenced by InitFontCache().

◆ UninitFreeType()

void UninitFreeType ( )

Free everything allocated w.r.t.

freetype.

Definition at line 303 of file freetypefontcache.cpp.

Referenced by UninitFontCache().

Variable Documentation

◆ _library

FT_Library _library = nullptr

Definition at line 49 of file freetypefontcache.cpp.