OpenTTD Source  13.2.1
fontcache.cpp File Reference
#include "stdafx.h"
#include "fontcache.h"
#include "fontdetection.h"
#include "blitter/factory.hpp"
#include "gfx_layout.h"
#include "fontcache/spritefontcache.h"
#include "openttd.h"
#include "settings_func.h"
#include "strings_func.h"
#include "viewport_func.h"
#include "window_func.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

int GetCharacterHeight (FontSize size)
 Get height of a character for a given font size. More...
 
bool GetFontAAState (FontSize size, bool check_blitter)
 
void SetFont (FontSize fontsize, const std::string &font, uint size, bool aa)
 
void InitFontCache (bool monospace)
 (Re)initialize the font cache related things, i.e. More...
 
void UninitFontCache ()
 Free everything allocated w.r.t. More...
 
bool HasAntialiasedFonts ()
 Should any of the active fonts be anti-aliased? More...
 

Variables

static const int _default_font_height [FS_END] = {10, 6, 18, 10}
 Default heights for the different sizes of fonts.
 
static const int _default_font_ascender [FS_END] = { 8, 5, 15, 8}
 
FontCacheSettings _fcsettings
 

Detailed Description

Cache for characters from fonts.

Definition in file fontcache.cpp.

Function Documentation

◆ GetCharacterHeight()

int GetCharacterHeight ( FontSize  size)

Get height of a character for a given font size.

Parameters
sizeFont size to get height of
Returns
Height of characters in the given font (pixels)

Definition at line 62 of file fontcache.cpp.

References FontCache::Get(), and FontCache::GetHeight().

Referenced by NWidgetResizeBase::SetMinimalSize(), and NWidgetResizeBase::SetMinimalTextLines().

◆ HasAntialiasedFonts()

bool HasAntialiasedFonts ( )

Should any of the active fonts be anti-aliased?

Returns
True if any of the loaded fonts want anti-aliased drawing.

Definition at line 169 of file fontcache.cpp.

References FS_BEGIN.

◆ InitFontCache()

void InitFontCache ( bool  monospace)

(Re)initialize the font cache related things, i.e.

load the non-sprite fonts.

Parameters
monospaceWhether to initialise the monospace or regular fonts.

Definition at line 128 of file fontcache.cpp.

References FS_BEGIN.

Referenced by MissingGlyphSearcher::FindMissingGlyphs(), and SetFallbackFont().

◆ UninitFontCache()

void UninitFontCache ( )

Free everything allocated w.r.t.

fonts.

Definition at line 152 of file fontcache.cpp.

References FS_BEGIN.