Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
Public Member Functions

WoopsiUI::FontBase Class Reference

#include <fontbase.h>

Inheritance diagram for WoopsiUI::FontBase:
WoopsiUI::PackedFontBase WoopsiUI::PackedFont1 WoopsiUI::PackedFont16 WoopsiUI::Arial9 WoopsiUI::BankGothic12 WoopsiUI::Batang12 WoopsiUI::Batang14 WoopsiUI::Batang15 WoopsiUI::Courier WoopsiUI::Courier12 WoopsiUI::Courier12b WoopsiUI::CourierNew10 WoopsiUI::CourierNew12 WoopsiUI::Dotum13 WoopsiUI::FixedSys12 WoopsiUI::Garamond10 WoopsiUI::GillSans11 WoopsiUI::GillSans11b WoopsiUI::Gloucester10 WoopsiUI::Goudy9 WoopsiUI::Gulimche12 WoopsiUI::Gulimche12b WoopsiUI::Gungsuh12 WoopsiUI::Gungsuh15 WoopsiUI::Gungsuhche11 WoopsiUI::Gungsuhche15 WoopsiUI::Kartika10 WoopsiUI::Kartika9 WoopsiUI::Latha10 WoopsiUI::Latha15 WoopsiUI::Latha9 WoopsiUI::LucidaCalligraphy14 WoopsiUI::Mangal9 WoopsiUI::Modern9 WoopsiUI::Modern9b WoopsiUI::MSGothic8 WoopsiUI::MSGothic9 WoopsiUI::MSSans9 WoopsiUI::MSSans9b WoopsiUI::MSSerif11 WoopsiUI::MSSerif11b WoopsiUI::NewTopaz WoopsiUI::OCRFont8 WoopsiUI::PoorRichard12 WoopsiUI::PoorRichard9 WoopsiUI::Roman11i WoopsiUI::Roman13 WoopsiUI::Roman13i WoopsiUI::Roman9b WoopsiUI::Script9b WoopsiUI::TimesNewRoman9 WoopsiUI::TinyFont WoopsiUI::Topaz WoopsiUI::Tunga8 WoopsiUI::GlyphFont WoopsiUI::ProFont9

List of all members.

Public Member Functions

 FontBase (const u8 height, const u16 transparentColour=0)
virtual ~FontBase ()
virtual const bool isCharBlank (const u32 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 (MutableBitmapBase *bitmap, u32 letter, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)=0
virtual s16 drawBaselineChar (MutableBitmapBase *bitmap, u32 letter, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)=0
virtual u16 getStringWidth (const WoopsiString &text) const =0
virtual u16 getStringWidth (const WoopsiString &text, s32 startIndex, s32 length) const =0
virtual u8 getCharWidth (u32 letter) const =0
virtual u8 getCharHeight (u32 letter) const
virtual s8 getCharTop (u32 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.


Constructor & Destructor Documentation

WoopsiUI::FontBase::FontBase ( const u8  height,
const u16  transparentColour = 0 
) [inline]

Constructor.

Parameters:
heightThe height of the font in pixels.
transparentColourThe colour in the font bitmap used as the background colour.
virtual WoopsiUI::FontBase::~FontBase ( ) [inline, virtual]

Destructor.


Member Function Documentation

void WoopsiUI::FontBase::clearColour ( ) [inline]

Resets back to multicolour mode if the font supports it and is currently set to monochrome mode.

virtual s16 WoopsiUI::FontBase::drawBaselineChar ( MutableBitmapBase bitmap,
u32  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 on a baseline.

Parameters:
bitmapThe bitmap to draw to.
letterThe character to output.
xThe x co-ordinate of the pen.
yThe y co-ordinate of the pen.
clipX1The left edge of the clipping rectangle.
clipY1The top edge of the clipping rectangle.
clipX2The right edge of the clipping rectangle.
clipY2The bottom edge of the clipping rectangle.
Returns:
The x co-ordinate for the next character to be drawn.

Implemented in WoopsiUI::PackedFontBase.

virtual s16 WoopsiUI::FontBase::drawChar ( MutableBitmapBase bitmap,
u32  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:
bitmapThe bitmap to draw to.
letterThe character to output.
xThe x co-ordinate of the text.
yThe y co-ordinate of the text.
clipX1The left edge of the clipping rectangle.
clipY1The top edge of the clipping rectangle.
clipX2The right edge of the clipping rectangle.
clipY2The bottom edge of the clipping rectangle.
Returns:
The x co-ordinate for the next character to be drawn.

Implemented in WoopsiUI::PackedFontBase.

virtual u8 WoopsiUI::FontBase::getCharHeight ( u32  letter) const [inline, virtual]

Get the height of an individual character.

Parameters:
letterThe letter to get the height of.
Returns:
The height of the character in pixels.
virtual s8 WoopsiUI::FontBase::getCharTop ( u32  letter) const [pure virtual]

Get the algebric distance from baseline to top of an individual character.

Parameters:
letterThe character to get the "top" of.
Returns:
The top of the character in pixels.

Implemented in WoopsiUI::PackedFontBase.

virtual u8 WoopsiUI::FontBase::getCharWidth ( u32  letter) const [pure virtual]

Get the width of an individual character.

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

Implemented in WoopsiUI::PackedFontBase.

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 WoopsiString text) const [pure virtual]

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

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

Implemented in WoopsiUI::PackedFontBase.

virtual u16 WoopsiUI::FontBase::getStringWidth ( const WoopsiString text,
s32  startIndex,
s32  length 
) const [pure virtual]

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

Parameters:
textThe string to check.
startIndexThe start point of the substring within the string.
lengthThe length of the substring in chars.
Returns:
The width of the substring in pixels.

Implemented in WoopsiUI::PackedFontBase.

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 u32  letter) const [pure virtual]

Checks if supplied character is blank in the current font.

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

Implemented in 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:
colourThe new drawing colour.
void WoopsiUI::FontBase::setTransparentColour ( const u16  colour) [inline]

Sets the transparent background colour to a new value.

Parameters:
colourThe new background colour.

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