Go to the documentation of this file.
10 #ifndef FONTCACHE_INTERNAL_H
11 #define FONTCACHE_INTERNAL_H
19 static const byte FACE_COLOUR = 1;
20 static const byte SHADOW_COLOUR = 2;
59 virtual const void *InternalGetFontTable(uint32 tag,
size_t &length) = 0;
60 virtual const Sprite *InternalGetGlyph(
GlyphID key,
bool aa) = 0;
70 const void *
GetFontTable(uint32 tag,
size_t &length)
override;
uint32 GlyphID
Glyphs are characters from a font.
Sprite * sprite
The loaded sprite.
FontTable font_tables
Cached font tables.
virtual SpriteID GetUnicodeGlyph(WChar key)=0
Get the SpriteID mapped to the given key.
const void * GetFontTable(uint32 tag, size_t &length) override
Read a font table from the font.
virtual ~TrueTypeFontCache()
Free everything that was allocated for this font cache.
Font cache for fonts that are based on a TrueType font.
bool duplicate
Whether this glyph entry is a duplicate, i.e. may this be freed?
char32_t WChar
Type for wide characters, i.e.
GlyphEntry ** glyph_to_sprite
The glyph cache.
SpriteID GetUnicodeGlyph(WChar key) override
Get the SpriteID mapped to the given key.
Container for information about a glyph.
uint GetGlyphWidth(GlyphID key) override
Get the width of the glyph with the given key.
bool GetDrawGlyphShadow() override
Do we need to draw a glyph shadow?
Implementation of simple mapping class.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
int GetFontSize() const override
Get the nominal font size of the font.
static constexpr int MAX_GLYPH_DIM
Maximum glyph dimensions.
static constexpr uint MAX_FONT_MIN_REC_SIZE
Upper limit for the recommended font size in case a font file contains nonsensical values.
const FontSize fs
The size of the font.
SmallMap< uint32, std::pair< size_t, const void * > > FontTable
Table with font table cache.
int req_size
Requested font size.
Font cache for basic fonts.
static const int MAX_FONT_SIZE
Maximum font size.
FontCache * parent
The parent of this font cache.
void SetUnicodeGlyph(WChar key, SpriteID sprite) override
Map a SpriteID to the key.
void ClearFontCache() override
Reset cached glyphs.
int used_size
Used font size.
TrueTypeFontCache(FontSize fs, int pixels)
Create a new TrueTypeFontCache.
byte width
The width of the glyph.
void InitializeUnicodeGlyphMap() override
Initialize the glyph map.
FontSize
Available font sizes.
const Sprite * GetGlyph(GlyphID key) override
Get the glyph (sprite) of the given key.
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite)=0
Map a SpriteID to the key.
Data structure describing a sprite.
virtual void InitializeUnicodeGlyphMap()=0
Initialize the glyph map.
bool IsBuiltInFont() override
Is this a built-in sprite font?