OpenTTD Source
1.11.0-beta2
|
#include "stdafx.h"
#include "fontcache.h"
#include "fontcache_internal.h"
#include "fontdetection.h"
#include "blitter/factory.hpp"
#include "core/math_func.hpp"
#include "core/smallmap_type.hpp"
#include "strings_func.h"
#include "zoom_type.h"
#include "gfx_layout.h"
#include "zoom_func.h"
#include "fileio_func.h"
#include "table/sprites.h"
#include "table/control_codes.h"
#include "table/unicode.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 | SpriteFontCache |
Font cache for fonts that are based on a freetype font. More... | |
class | FreeTypeFontCache |
Font cache for fonts that are based on a freetype font. More... | |
Macros | |
#define | CPSET { 0, 0, 0, 0, 1 } |
#define | CP___ { 0, 0, 0, 0, 0 } |
Functions | |
int | GetCharacterHeight (FontSize size) |
Get height of a character for a given font size. More... | |
static bool | GetFontAAState (FontSize size, bool check_blitter=true) |
static void | LoadFreeTypeFont (FontSize fs) |
Loads the freetype font. More... | |
void | InitFreeType (bool monospace) |
(Re)initialize the freetype related things, i.e. More... | |
void | UninitFreeType () |
Free everything allocated w.r.t. More... | |
bool | HasAntialiasedFonts () |
Should any of the active fonts be anti-aliased? More... | |
Variables | |
static const int | ASCII_LETTERSTART = 32 |
First printable ASCII letter. | |
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} |
FreeTypeSettings | _freetype |
FT_Library | _library = nullptr |
Cache for characters from fonts.
Definition in file fontcache.cpp.
int GetCharacterHeight | ( | FontSize | size | ) |
Get height of a character for a given font size.
size | Font size to get height of |
Definition at line 69 of file fontcache.cpp.
References FontCache::Get(), and FontCache::GetHeight().
Referenced by NWidgetResizeBase::SetMinimalTextLines().
bool HasAntialiasedFonts | ( | ) |
Should any of the active fonts be anti-aliased?
Definition at line 723 of file fontcache.cpp.
References FS_BEGIN.
void InitFreeType | ( | bool | monospace | ) |
(Re)initialize the freetype related things, i.e.
load the non-sprite fonts.
monospace | Whether to initialise the monospace or regular fonts. |
Definition at line 683 of file fontcache.cpp.
References FS_BEGIN.
Referenced by MissingGlyphSearcher::FindMissingGlyphs(), and SetFallbackFont().
|
static |
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'.
fs | The font size to load. |
Definition at line 485 of file fontcache.cpp.
References settings.
void UninitFreeType | ( | ) |
Free everything allocated w.r.t.
fonts.
Definition at line 706 of file fontcache.cpp.
References FS_BEGIN.