Font class reference


The font management class. Allows to load several font sizes at the same time.

Functions documentation

Font(std::string fontPath, int iFlags = 0);

Default constructor


Font(const Font& copy) = delete;

No copy constructor for now.


~Font();

Descturctor. Release all allocated memory & destroys SubFont objects.


void LoadFontSize(int fontSize, int preloadAmount = 0, Dimension<size_t> maxFontDims = {512, 512});

Loads a specific font size into memory. Allows to automatically load some glyphs.


bool IsSizeLoaded(int fontSize);

Checks whether the font size is already loaded.


void ReleaseFontSize(int fontSize);

Removes a font with a specific size from memory.


const int GetFontDpi() const;

Returns the DPI of the screen.


const GlyphData* GetGlyph(int fontSize, int ch);

Returns glyph data for a specific font size.


Texture* GetAtlasTexture(int fontSize);

Returns atlas texture for a specific font size.


const int GetLineHeight(int fontSize);

Returns new line height for a specific font size.


std::map<int, GlyphData>::iterator AddGlyph(int fontSize, int ch);

Adds a glyph (from the character) to a font of a specific size.


Variables documentation

int m_iFlags;

Stores flags. Reserved.


std::string m_sFontPath;

Stores the path of the loaded file.


std::map<int, SubFont*> m_SubFonts;

It stores a data of specific sizes of a given font.


FT_Face m_Face;

FreeType variable that stores font Face.


FT_Bool m_HasKernings;

FreeType variable that describes whether the font supports kernings.


static FT_Library s_FTLibrary;

A handle to a FreeType library instance.


static bool s_FT2Initialized;

Describes whether the FreeType library is initialized or not.