StuBS
Loading...
Searching...
No Matches
Font Class Reference

Monospaced fonts. More...

#include <font.h>

Public Member Functions

 Font (const char *name, unsigned width, unsigned height, const unsigned char *data)
 Constructor for a font.
 
const void * symbol (unsigned char c) const
 Get bitmap address for a given character.
 

Static Public Member Functions

static Fontget (const char *name=nullptr, unsigned width=0, unsigned height=0)
 Find font.
 
static unsigned number ()
 Get the number of available fonts.
 

Public Attributes

const char * name
 Name of font.
 
const unsigned width
 Width of a character.
 
const unsigned height
 Height of a character.
 

Private Attributes

const unsigned char * data
 Pointer to bitmap font.
 
const size_t size
 Size in memory of bitmap font.
 

Detailed Description

Monospaced fonts.

Console fonts are extracted from the Linux kernel (/lib/fonts/).

Constructor & Destructor Documentation

◆ Font()

Font::Font ( const char * name,
unsigned width,
unsigned height,
const unsigned char * data )
inline

Constructor for a font.

Parameters
nameName of font
widthcharacter width
heightcharacter height
dataPointer to bitmap font

Member Function Documentation

◆ get()

Font * Font::get ( const char * name = nullptr,
unsigned width = 0,
unsigned height = 0 )
static

Find font.

Parameters
nameName of font (or nullptr for any)
widthWidth of a character (or 0 for any)
heightHeight of a character (or 0 for any)
Returns
Pointer to font or nullptr if no matching font was found

◆ number()

unsigned Font::number ( )
static

Get the number of available fonts.

Returns
number of fonts

◆ symbol()

const void * Font::symbol ( unsigned char c) const
inline

Get bitmap address for a given character.

Parameters
ccharacter (ASCII)
Returns
Pointer to bitmap of character

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