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

Class representing a bitmap font. More...

#include <BmpFont.h>

Inheritance diagram for etm::BmpFont:
etm::EtmFont

Public Member Functions

 BmpFont (const std::string &path, char_t startCodepoint, char_t glyphWidth, char_t glyphHeight, char_t count)
 Create a bitmap font. More...
 
void setResMan (Resources *res) override
 Does nothing, we don't need it. More...
 
void setSize (unsigned int size) override
 Does nothing, partly because bitmap fonts aren't meant to be scalable (and look like shit when they are), but also because the class's memory footprint would have to double in order to support scaling. More...
 
void bindChar (char_t c) override
 Binds the given codepoint's texture to the currently active OpenGL texture slot. More...
 
void clearCache () override
 Does nothing, as there's no 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

Class representing a bitmap font.

See also
Font

Constructor & Destructor Documentation

◆ BmpFont()

etm::BmpFont::BmpFont ( const std::string &  path,
char_t  startCodepoint,
char_t  glyphWidth,
char_t  glyphHeight,
char_t  count 
)

Create a bitmap font.

Warning
When created, will fill texture objects, binding itself to the current context. Make sure the desired context is current!
Note
The first glyph in the bitmap is interpreted as the null character - the char that will be displayed if the given codepoint is out of range.
Expects the given image to have only two channels (be black and white)
Parameters
[in]pathPath to the bitmap
[in]startCodepointThe value of the starting codepoint. This will be the second glyph in the list, for previously stated reasons.
[in]glyphWidthThe pixel width of each glyph
[in]glyphHeightThe pixel height of each glyph
[in]countThe number of glyphs contained within the bitmap, not including the first "null" glyph.
Exceptions
std::invalid_argumentif the given path cannot be opened or decoded

Member Function Documentation

◆ bindChar()

void etm::BmpFont::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::BmpFont::getCharHeight ( )
overridevirtual

Gets the height of each codepoint.

Returns
The height
See also
charHeight

Implements etm::EtmFont.

◆ getCharWidth()

int etm::BmpFont::getCharWidth ( )
overridevirtual

Gets the width of each codepoint.

Returns
The width
See also
charWidth

Implements etm::EtmFont.

◆ setResMan()

void etm::BmpFont::setResMan ( Resources *  res)
overridevirtual

Does nothing, we don't need it.

Parameters
[in]res[ignored]

Implements etm::EtmFont.

◆ setSize()

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

Does nothing, partly because bitmap fonts aren't meant to be scalable (and look like shit when they are), but also because the class's memory footprint would have to double in order to support scaling.

Parameters
[in]size[ignored]

Implements etm::EtmFont.


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