A simple yet powerful library for controlling graphical displays. Multiple display controllers are supported using inheritance.

Dependents:   mbed_rifletool Hexi_Bubble_Game Hexi_Catch-the-dot_Game Hexi_Acceleromagnetic_Synth

Embed: (wiki syntax)

« Back to documentation index

Font Class Reference

Font Class Reference

Font class. More...

#include <Font.h>

Public Member Functions

 Font (const char *table)
 Create a white Font object.
 Font (const char *table, unsigned int color)
 Create a Font object with the specified color.
BitmapImage glyph (char c)
 Get the glyph Image for the specified character.
unsigned int color ()
 Get the current Font color.
void color (unsigned int c)
 Set the Font color.
int height ()
 Get the height of the Font glyphs.
int measureString (const char *str)
 Measures the width of a string in pixels if drawn with this font.
int measureWord (const char *str)
 Measures the width of the next word in a string (separated by whitespace) in pixels if drawn with this font.

Detailed Description

Font class.

Used to access font data in an external table.

Definition at line 26 of file Font.h.


Constructor & Destructor Documentation

Font ( const char *  table )

Create a white Font object.

Parameters:
tablePointer to the font table.

Definition at line 19 of file Font.cpp.

Font ( const char *  table,
unsigned int  color 
)

Create a Font object with the specified color.

Parameters:
tablePointer to the font table.
colorColor for the font as a 32-bit ARGB value.

Definition at line 25 of file Font.cpp.


Member Function Documentation

unsigned int color (  )

Get the current Font color.

Returns:
The current Font color as a 32-bit ARGB value.

Definition at line 51 of file Font.cpp.

void color ( unsigned int  c )

Set the Font color.

Parameters:
cThe new Font color as a 32-bit ARGB value.

Definition at line 56 of file Font.cpp.

BitmapImage glyph ( char  c )

Get the glyph Image for the specified character.

Returns:
The character glyph Image.

Definition at line 31 of file Font.cpp.

int height (  )

Get the height of the Font glyphs.

Returns:
The height of the Font glyphs.

Definition at line 61 of file Font.cpp.

int measureString ( const char *  str )

Measures the width of a string in pixels if drawn with this font.

Parameters:
strPointer to the string to measure.
Returns:
The width of the string in pixels.

Definition at line 66 of file Font.cpp.

int measureWord ( const char *  str )

Measures the width of the next word in a string (separated by whitespace) in pixels if drawn with this font.

Parameters:
strPointer to the string to measure.
Returns:
The width of the next word in pixels.

Definition at line 80 of file Font.cpp.