Static Public Member Functions

Detailed Description

A Font that can be used to draw text. Fonts are immutable except they can be assigned with operator=. Users are not expected to create instances of the Font class directly. Rather, the default use case is to use the pre-instantiated fonts in misc_inst.h, like droid11()

Constructor & Destructor Documentation

mxgui::Font::Font

(

unsigned char

startChar,

unsigned char

endChar,

unsigned char

height,

unsigned char

width,

unsigned char

dataSize,

bool

antialiased,

const void *

data

)

Creates a fixed width font.

Parameters:

startChar

the first character available, example ' ' (ASCII space)

endChar

the last character available (including)

height

the height of the glyphs

width

the width of the glyphs (fixed width font)

dataSize

can be 8,16 or 32, it is the size of one element of data

antialiased

true if font is antialiased

data

pinter to the font data. This must point to a static array so that no memeory leak problems occur

mxgui::Font::Font

(

unsigned char

startChar,

unsigned char

endChar,

unsigned char

height,

unsigned char

dataSize,

bool

antialiased,

const unsigned char *

widths,

const unsigned short *

offset,

const void *

data

)

Creates a variable width font.

Parameters:

startChar

the first character available, example ' ' (ASCII space)

endChar

the last character available (including)

height

the height of the glyphs

dataSize

can be 8,16 or 32, it is the size of one element of data

antialiased

true if font is antialiased

widths

pointer to a table that contains the widths of each glyph. This must point to a static arra so that no memeory leak problems occur

offset

pointer to a table that contains where in data each glyph begins ( data[offset[c]]) This must point to a static arra so that no memeory leak problems occur

data

pinter to the font data. This must point to a static array so that no memeory leak problems occur

Member Function Documentation

short int mxgui::Font::calculateLength

(

const char *

s

)

const

Given a string, determine the length in pixels required to draw it. If the string contains characters not between getStartChar and getEndChar their width is supposed to be the length of the character returned by getStartChar.