| OpenTTD
    | 
Cache for characters from fonts. More...
#include "stdafx.h"#include "fontcache.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 "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... | |
| struct | FreeTypeFontCache::GlyphEntry | 
| Container for information about a glyph.  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. | |
| static void | LoadFreeTypeFont (FontSize fs) | 
| Loads the freetype font. | |
| static void * | AllocateFont (size_t size) | 
| static bool | GetFontAAState (FontSize size) | 
| void | InitFreeType (bool monospace) | 
| (Re)initialize the freetype related things, i.e. | |
| void | UninitFreeType () | 
| Free everything allocated w.r.t. | |
| Variables | |
| static const int | ASCII_LETTERSTART = 32 | 
| First printable ASCII letter. | |
| static const int | MAX_FONT_SIZE = 72 | 
| Maximum font size. | |
| 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} | 
| FT_Library | _library = NULL | 
| FreeTypeSettings | _freetype | 
| static const byte | FACE_COLOUR = 1 | 
| static const byte | SHADOW_COLOUR = 2 | 
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 63 of file fontcache.cpp.
References FontCache::Get(), and FontCache::GetHeight().
Referenced by BaseGraphWindow::DrawGraph(), NWidgetResizeBase::SetMinimalTextLines(), and StationsWndShowStationRating().
| 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 643 of file fontcache.cpp.
References FS_BEGIN, FS_MONO, FontCache::Get(), FontCache::HasParent(), and LoadFreeTypeFont().
Referenced by CheckForMissingGlyphs(), MissingGlyphSearcher::FindMissingGlyphs(), openttd_main(), 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 324 of file fontcache.cpp.
References DEBUG, error(), FreeTypeSubSetting::font, FS_LARGE, FS_MONO, FS_NORMAL, FS_SMALL, GetFontByFaceName(), FreeTypeSettings::large, FreeTypeSettings::medium, FreeTypeSettings::mono, ShowInfoF(), FreeTypeSubSetting::size, FreeTypeSettings::small, and StrEmpty().
Referenced by InitFreeType().
| void UninitFreeType | ( | ) | 
Free everything allocated w.r.t.
fonts.
Definition at line 660 of file fontcache.cpp.
References FS_BEGIN, FontCache::Get(), and FontCache::HasParent().
Referenced by ShutdownGame().
| 
 | static | 
Default heights for the different sizes of fonts.
Definition at line 33 of file fontcache.cpp.
Referenced by FreeTypeFontCache::FreeTypeFontCache().
 1.8.1.2
 1.8.1.2