WoopsiUI::FixedWidthFontBase Class Reference

#include <fixedwidthfontbase.h>

Inheritance diagram for WoopsiUI::FixedWidthFontBase:
WoopsiUI::FontBase WoopsiUI::Font WoopsiUI::MonoFont

List of all members.

Public Member Functions

 FixedWidthFontBase (const u16 bitmapWidth, const u16 bitmapHeight, const u8 width, const u8 height, const u16 transparentColour=0)
virtual ~FixedWidthFontBase ()
const u16 getBitmapWidth () const
const u16 getBitmapHeight () const
virtual const u16 getPixel (const s16 x, const s16 y) const =0
const u8 getWidth () const
u16 getStringWidth (const char *text) const
u16 getStringWidth (const char *text, u16 length) const
u16 getCharWidth (char letter) const
virtual const bool isCharBlank (const char letter) const

Protected Member Functions

virtual void createGlyphMap ()
virtual const bool scanGlyph (const u16 x, const u16 y) const =0
void initGlyphMap ()

Protected Attributes

u8 _glyphMap [GLYPH_MAP_SIZE]

Detailed Description

Abstract class defining the basic properties of a fixed-width font and providing some of the essential functionality. Should be used as a base class for all fixed-width fonts.


Constructor & Destructor Documentation

WoopsiUI::FixedWidthFontBase::FixedWidthFontBase ( const u16  bitmapWidth,
const u16  bitmapHeight,
const u8  width,
const u8  height,
const u16  transparentColour = 0 
)

Constructor.

Parameters:
bitmapWidth The width of the bitmap containing the font's glyph data.
bitmapHeight The height of the bitmap containing the font's glyph data.
width The width of an individual glyph.
height The height of the font.
transparentColour The colour in the font bitmap used as the background colour.
virtual WoopsiUI::FixedWidthFontBase::~FixedWidthFontBase (  )  [inline, virtual]

Destructor.


Member Function Documentation

virtual void WoopsiUI::FixedWidthFontBase::createGlyphMap (  )  [protected, virtual]

Populates the previously created glyph map with the data on which glyphs have data and which do not. Does this by scanning through each pixel in each glyph and adding true to the map if data is found or false if no data is found.

See also:
initGlyphMap().
const u16 WoopsiUI::FixedWidthFontBase::getBitmapHeight (  )  const [inline]

Gets the height of the font's glyph bitmap.

Returns:
The height of the font's glyph bitmap.
const u16 WoopsiUI::FixedWidthFontBase::getBitmapWidth (  )  const [inline]

Gets the width of the font's glyph bitmap.

Returns:
The width of the font's glyph bitmap.
u16 WoopsiUI::FixedWidthFontBase::getCharWidth ( char  letter  )  const [inline, virtual]

Get the width of an individual character.

Parameters:
letter The character to get the width of.
Returns:
The width of the character in pixels.

Implements WoopsiUI::FontBase.

virtual const u16 WoopsiUI::FixedWidthFontBase::getPixel ( const s16  x,
const s16  y 
) const [pure virtual]

Get the colour of the pixel at specified co-ordinates.

Parameters:
x The x co-ordinate of the pixel.
y The y co-ordinate of the pixel.
Returns:
The colour of the pixel.

Implemented in WoopsiUI::Font, and WoopsiUI::MonoFont.

u16 WoopsiUI::FixedWidthFontBase::getStringWidth ( const char *  text,
u16  length 
) const [inline, virtual]

Get the width of a string with a specified length in pixels when drawn with this font. Useful if you want to determine the length of a string without a terminator, or the length of a section of a string.

Parameters:
text The string to check.
length The length of the string in chars.
Returns:
The width of the string in pixels.

Implements WoopsiUI::FontBase.

u16 WoopsiUI::FixedWidthFontBase::getStringWidth ( const char *  text  )  const [inline, virtual]

Get the width of a string in pixels when drawn with this font.

Parameters:
text The string to check.
Returns:
The width of the string in pixels.

Implements WoopsiUI::FontBase.

const u8 WoopsiUI::FixedWidthFontBase::getWidth (  )  const [inline]

Gets the width of an individual glyph.

Returns:
The width of an individual glyph.
void WoopsiUI::FixedWidthFontBase::initGlyphMap (  )  [protected]

Creates a map of which glyphs have data and which do not.

See also:
createGlyphMap().
virtual const bool WoopsiUI::FixedWidthFontBase::isCharBlank ( const char  letter  )  const [inline, virtual]

Checks if supplied character is blank in the current font.

Parameters:
letter The character to check.
Returns:
True if the glyph contains any pixels to be drawn. False if the glyph is blank.

Implements WoopsiUI::FontBase.

virtual const bool WoopsiUI::FixedWidthFontBase::scanGlyph ( const u16  x,
const u16  y 
) const [protected, pure virtual]

Scans the glyph bitmap at the specified co-ordinates to see if it contains data or not. Must be overridden.

Parameters:
x The x co-ordinate of the start of the glyph.
y The y co-ordinate of the start of the glyph.
Returns:
True if the glyph bitmap contains data for this glyph.

Member Data Documentation

u8 WoopsiUI::FixedWidthFontBase::_glyphMap[GLYPH_MAP_SIZE] [protected]

Map of which characters have glyphs in the current font


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

Generated on Sun Nov 15 11:35:36 2009 for Woopsi by  doxygen 1.6.1