Etermal
Embeddable Terminal and shell for OpenGL
Public Member Functions | List of all members
etm::Font Class Reference

Takes care of rendering codepoints and binding their textures. More...

#include <Font.h>

Inheritance diagram for etm::Font:
etm::EtmFont

Public Member Functions

 Font (const std::string &path)
 Construct a Font. More...
 
 Font (Font &&other)
 Initialize with moved object. More...
 
 ~Font ()
 Destruct Font. More...
 
Fontoperator= (Font &&other)
 Assign to moved object. More...
 
void setResMan (Resources *res) override
 
void setSize (unsigned int size) override
 Set the pixel size of the font. More...
 
void bindChar (char_t c) override
 Binds the given codepoint's texture to the currently active OpenGL texture slot. More...
 
void clearCache () override
 Clears the codepoint texture cache.
 
int getCharWidth () override
 Gets the width of each codepoint. More...
 
int getCharHeight () override
 Gets the height of each codepoint. More...
 

Additional Inherited Members

- Public Types inherited from etm::EtmFont
typedef unsigned int char_t
 Codepoint type.
 

Detailed Description

Takes care of rendering codepoints and binding their textures.

Works with a cache to save run time.

Constructor & Destructor Documentation

◆ Font() [1/2]

etm::Font::Font ( const std::string &  path)

Construct a Font.

Contains a root font library object, which is a good and bad thing.

Parameters
[in]pathThe path to the font resource
Exceptions
std::logic_errorif failed to create freetype library
std::invalid_argumentif failed to create font face from given path

◆ Font() [2/2]

etm::Font::Font ( Font &&  other)

Initialize with moved object.

Parameters
[in,out]otherMoved object

◆ ~Font()

etm::Font::~Font ( )

Destruct Font.

If the lib parameter that was given to it upon construction is deleted, then undefined behavior is invoked (IIRC).

See also
Font(Resources *res, FontLibrary &lib, const std::string &path)

Member Function Documentation

◆ bindChar()

void etm::Font::bindChar ( char_t  c)
overridevirtual

Binds the given codepoint's texture to the currently active OpenGL texture slot.

Parameters
[in]cThe codepoint to bind

Implements etm::EtmFont.

◆ getCharHeight()

int etm::Font::getCharHeight ( )
overridevirtual

Gets the height of each codepoint.

Returns
The height
See also
charHeight

Implements etm::EtmFont.

◆ getCharWidth()

int etm::Font::getCharWidth ( )
overridevirtual

Gets the width of each codepoint.

Returns
The width
See also
charWidth

Implements etm::EtmFont.

◆ operator=()

Font& etm::Font::operator= ( Font &&  other)

Assign to moved object.

Parameters
[in,out]otherMoved object

◆ setSize()

void etm::Font::setSize ( unsigned int  size)
overridevirtual

Set the pixel size of the font.

Parameters
[in]sizeThe pixel size

Implements etm::EtmFont.


The documentation for this class was generated from the following file: