CTurtle
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cturtle::BitmapFont Class Reference

The Bitmap Font represents monospaced font image files that covers a range of lower ASCII. The default font, for example, covers 32-127 (e.g, char 32 to char 127). This is a particularly naive implementation of bitmap fonts, however, all basic properties required are here. More...

#include <CTurtle.hpp>

Public Member Functions

 BitmapFont (const Image &img, int asciiOffs, int glyphWidth, int glyphHeight, int glyphsX, int glyphsY)
 
const Image & getGlyphImage (unsigned char c) const
 
const Image & operator[] (unsigned char c) const
 
ivec2 getGlyphPosition (unsigned char c) const
 Returns the position of the specified character in the font image.
 
ivec2 getGlyphExtent () const
 Returns the size of a single character glyph, in pixels.
 
int getTotalGlyphs () const
 
bool isValid (char c) const
 
ivec2 getGlyphAxes () const
 Returns the number of glyphs along each axis of the underlying image.
 

Detailed Description

The Bitmap Font represents monospaced font image files that covers a range of lower ASCII. The default font, for example, covers 32-127 (e.g, char 32 to char 127). This is a particularly naive implementation of bitmap fonts, however, all basic properties required are here.

Constructor & Destructor Documentation

◆ BitmapFont()

cturtle::BitmapFont::BitmapFont ( const Image & img,
int asciiOffs,
int glyphWidth,
int glyphHeight,
int glyphsX,
int glyphsY )
inline

Bitmap Font constructor.

Parameters
asciiOffs
glyphWidth
glyphHeight
glyphsX
glyphsY

Member Function Documentation

◆ getGlyphAxes()

ivec2 cturtle::BitmapFont::getGlyphAxes ( ) const
inline

Returns the number of glyphs along each axis of the underlying image.

Returns
the number of glyphs along each axis of the underlying image.

◆ getGlyphExtent()

ivec2 cturtle::BitmapFont::getGlyphExtent ( ) const
inline

Returns the size of a single character glyph, in pixels.

Returns
the width (x) and height (y) of the glyph, in pixels.

◆ getGlyphImage()

const Image & cturtle::BitmapFont::getGlyphImage ( unsigned char c) const
inline

Returns the appropriate image for the specified character.

Parameters
ccharacter to retrieve the associated image for.

◆ getGlyphPosition()

ivec2 cturtle::BitmapFont::getGlyphPosition ( unsigned char c) const
inline

Returns the position of the specified character in the font image.

Parameters
ccharacter to get the position of
Returns
position of the character.

◆ getTotalGlyphs()

int cturtle::BitmapFont::getTotalGlyphs ( ) const
inline
Returns
the total number of valid glyphs in this bitmap font.

◆ isValid()

bool cturtle::BitmapFont::isValid ( char c) const
inline
Returns
a boolean indicating if the specified character is valid within this bitmap font.

◆ operator[]()

const Image & cturtle::BitmapFont::operator[] ( unsigned char c) const
inline

Returns the appropriate image for the specified character.

Parameters
ccharacter to retrieve the associated image for.

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