OpenTTD Source: src/fontcache/spritefontcache.h Source File

OpenTTD Source 15.3

spritefontcache.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef SPRITEFONTCACHE_H
11#define SPRITEFONTCACHE_H
12
13#include "../fontcache.h"
14
16 class SpriteFontCache : public FontCache {
17public:
18 SpriteFontCache(FontSize fs);
19 void ClearFontCache() override;
20 const Sprite *GetGlyph(GlyphID key) override;
21 uint GetGlyphWidth(GlyphID key) override;
22 bool GetDrawGlyphShadow() override;
23 GlyphID MapCharToGlyph(char32_t key, bool allow_fallback = true) override;
24 std::string GetFontName() override { return "sprite"; }
25 bool IsBuiltInFont() override { return true; }
26};
27
28#endif /* SPRITEFONTCACHE_H */
FontCache
Font cache for basic fonts.
Definition fontcache.h:22
FontCache::fs
const FontSize fs
The size of the font.
Definition fontcache.h:26
SpriteFontCache
Font cache for fonts that are based on a freetype font.
Definition spritefontcache.h:16
SpriteFontCache::GetGlyphWidth
uint GetGlyphWidth(GlyphID key) override
Get the width of the glyph with the given key.
Definition spritefontcache.cpp:137
SpriteFontCache::MapCharToGlyph
GlyphID MapCharToGlyph(char32_t key, bool allow_fallback=true) override
Map a character into a glyph.
Definition spritefontcache.cpp:144
SpriteFontCache::GetDrawGlyphShadow
bool GetDrawGlyphShadow() override
Do we need to draw a glyph shadow?
Definition spritefontcache.cpp:152
SpriteFontCache::GetFontName
std::string GetFontName() override
Get the name of this font.
Definition spritefontcache.h:24
SpriteFontCache::ClearFontCache
void ClearFontCache() override
Clear the font cache.
Definition spritefontcache.cpp:123
SpriteFontCache::GetGlyph
const Sprite * GetGlyph(GlyphID key) override
Get the glyph (sprite) of the given key.
Definition spritefontcache.cpp:130
SpriteFontCache::IsBuiltInFont
bool IsBuiltInFont() override
Is this a built-in sprite font?
Definition spritefontcache.h:25
GlyphID
uint32_t GlyphID
Glyphs are characters from a font.
Definition fontcache.h:18
FontSize
FontSize
Available font sizes.
Definition gfx_type.h:248
Sprite
Data structure describing a sprite.
Definition spritecache_type.h:16