10#ifndef TRUETYPEFONTCACHE_H
11#define TRUETYPEFONTCACHE_H
13#include "../fontcache.h"
18static const uint8_t FACE_COLOUR = 1;
19static const uint8_t SHADOW_COLOUR = 2;
32 std::unique_ptr<uint8_t[]>
data;
38 std::unordered_map<GlyphID, GlyphEntry> glyph_to_sprite_map{};
40 GlyphEntry *GetGlyphPtr(
GlyphID key);
41 GlyphEntry &SetGlyphPtr(
GlyphID key, GlyphEntry &&glyph);
43 virtual const Sprite *InternalGetGlyph(
GlyphID key,
bool aa) = 0;
Font cache for basic fonts.
FontCache * parent
The parent of this font cache.
virtual void InitializeUnicodeGlyphMap()=0
Initialize the glyph map.
const FontSize fs
The size of the font.
virtual void SetUnicodeGlyph(char32_t key, SpriteID sprite)=0
Map a SpriteID to the key.
Font cache for fonts that are based on a TrueType font.
static constexpr int MAX_GLYPH_DIM
Maximum glyph dimensions.
int used_size
Used font size.
uint GetGlyphWidth(GlyphID key) override
Get the width of the glyph with the given key.
void InitializeUnicodeGlyphMap() override
Initialize the glyph map.
void SetUnicodeGlyph(char32_t key, SpriteID sprite) override
Map a SpriteID to the key.
const Sprite * GetGlyph(GlyphID key) override
Get the glyph (sprite) of the given key.
bool GetDrawGlyphShadow() override
Do we need to draw a glyph shadow?
int req_size
Requested font size.
int GetFontSize() const override
Get the nominal font size of the font.
void ClearFontCache() override
Reset cached glyphs.
bool IsBuiltInFont() override
Is this a built-in sprite font?
virtual ~TrueTypeFontCache()
Free everything that was allocated for this font cache.
static constexpr uint MAX_FONT_MIN_REC_SIZE
Upper limit for the recommended font size in case a font file contains nonsensical values.
uint32_t GlyphID
Glyphs are characters from a font.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
FontSize
Available font sizes.
Data structure describing a sprite.
Container for information about a glyph.
std::unique_ptr< uint8_t[]> data
The loaded sprite.
uint8_t width
The width of the glyph.
static const int MAX_FONT_SIZE
Maximum font size.