WoopsiUI::FontBase Class Reference
#include <fontbase.h>
List of all members.
Public Member Functions |
| FontBase (const u8 height, const u16 transparentColour=0) |
virtual | ~FontBase () |
virtual const bool | isCharBlank (const char letter) const =0 |
void | setColour (const u16 colour) |
const u16 | getColour () const |
const bool | isMonochrome () const |
const u16 | getTransparentColour () const |
void | setTransparentColour (const u16 colour) |
void | clearColour () |
virtual s16 | drawChar (u16 *bitmap, u16 bitmapWidth, u16 bitmapHeight, char letter, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)=0 |
virtual u16 | getStringWidth (const char *text) const =0 |
virtual u16 | getStringWidth (const char *text, u16 length) const =0 |
virtual u16 | getCharWidth (char letter) const =0 |
const u8 | getHeight () const |
Detailed Description
Abstract class defining the basic properties of a font and providing some of the essential functionality. Should be used as a base class for all fonts. This class does not currently allow for non-bitmap fonts.
Constructor & Destructor Documentation
WoopsiUI::FontBase::FontBase |
( |
const u8 |
height, |
|
|
const u16 |
transparentColour = 0 | |
|
) |
| | [inline] |
Constructor.
- Parameters:
-
| height | The height of the font in pixels. |
| transparentColour | The colour in the font bitmap used as the background colour. |
virtual WoopsiUI::FontBase::~FontBase |
( |
|
) |
[inline, virtual] |
Member Function Documentation
void WoopsiUI::FontBase::clearColour |
( |
|
) |
[inline] |
Resets back to mulitcolour mode if the font supports it and is currently set to monochrome mode.
virtual s16 WoopsiUI::FontBase::drawChar |
( |
u16 * |
bitmap, |
|
|
u16 |
bitmapWidth, |
|
|
u16 |
bitmapHeight, |
|
|
char |
letter, |
|
|
s16 |
x, |
|
|
s16 |
y, |
|
|
u16 |
clipX1, |
|
|
u16 |
clipY1, |
|
|
u16 |
clipX2, |
|
|
u16 |
clipY2 | |
|
) |
| | [pure virtual] |
Draw an individual character of the font to the specified bitmap.
- Parameters:
-
| bitmap | The bitmap to draw to. |
| bitmapWidth | The width of the bitmap being drawn to. |
| bitmapHeight | The height of the bitmap being drawn to. |
| letter | The character to output. |
| x | The x co-ordinate of the text. |
| y | The y co-ordinate of the text. |
| clipX1 | The left edge of the clipping rectangle. |
| clipY1 | The top edge of the clipping rectangle. |
| clipX2 | The right edge of the clipping rectangle. |
| clipY2 | The bottom edge of the clipping rectangle. |
- Returns:
- The x co-ordinate for the next character to be drawn.
Implemented in WoopsiUI::Font, WoopsiUI::MonoFont, and WoopsiUI::PackedFontBase.
virtual u16 WoopsiUI::FontBase::getCharWidth |
( |
char |
letter |
) |
const [pure virtual] |
const u16 WoopsiUI::FontBase::getColour |
( |
|
) |
const [inline] |
Gets the colour currently being used as the drawing colour. This should be used in conjunction with isMonochrome() to determine if this is really being used or not; isMonochrome() must be true for this colour to be used.
- Returns:
- The current drawing colour.
const u8 WoopsiUI::FontBase::getHeight |
( |
|
) |
const [inline] |
Gets the height of the font.
- Returns:
- The height of the font.
virtual u16 WoopsiUI::FontBase::getStringWidth |
( |
const char * |
text, |
|
|
u16 |
length | |
|
) |
| | const [pure 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.
Implemented in WoopsiUI::FixedWidthFontBase, and WoopsiUI::PackedFontBase.
virtual u16 WoopsiUI::FontBase::getStringWidth |
( |
const char * |
text |
) |
const [pure virtual] |
const u16 WoopsiUI::FontBase::getTransparentColour |
( |
|
) |
const [inline] |
Get the colour currently being used as the transparent background colour.
- Returns:
- The transparent background colour.
virtual const bool WoopsiUI::FontBase::isCharBlank |
( |
const char |
letter |
) |
const [pure 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.
Implemented in WoopsiUI::FixedWidthFontBase, and WoopsiUI::PackedFontBase.
const bool WoopsiUI::FontBase::isMonochrome |
( |
|
) |
const [inline] |
Returns true if the current font is being drawn using a single colour.
- Returns:
- True if the current font is monochrome.
void WoopsiUI::FontBase::setColour |
( |
const u16 |
colour |
) |
[inline] |
Sets the colour to use as the drawing colour. If set, this overrides the colours present in a non-monochrome font.
- Parameters:
-
| colour | The new drawing colour. |
void WoopsiUI::FontBase::setTransparentColour |
( |
const u16 |
colour |
) |
[inline] |
Sets the transparent background colour to a new value.
- Parameters:
-
| colour | The new background colour. |
The documentation for this class was generated from the following file:
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/fontbase.h