WoopsiGfx 1.4
Nintendo DS 2D Graphics Library
Public Member Functions | Protected Attributes
WoopsiGfx::PackedFontBase Class Reference

#include <libwoopsigfx/include/packedfontbase.h>

Inheritance diagram for WoopsiGfx::PackedFontBase:
WoopsiGfx::FontBase WoopsiGfx::PackedFont1 WoopsiGfx::PackedFont16

List of all members.

Public Member Functions

 PackedFontBase (u8 first, u8 last, const u16 *glyphData, const u16 *glyphOffset, const u8 *glyphWidth, const u8 height, const u8 spWidth, const u8 fontTop, const u8 fixedWidth=0)
void setFontWidth (u8 fontWidth)
virtual s16 drawChar (MutableBitmapBase *bitmap, u32 letter, u16 colour, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)
virtual s16 drawBaselineChar (MutableBitmapBase *bitmap, u32 letter, u16 colour, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)
virtual u16 getStringWidth (const WoopsiString &text) const
virtual u16 getStringWidth (const WoopsiString &text, s32 startIndex, s32 length) const
virtual u8 getCharWidth (u32 letter) const
virtual s8 getCharTop (u32 letter) const
const bool isCharBlank (const u32 letter) const
const u8 getHeight () const
virtual u8 getCharHeight (u32 letter) const
virtual void renderChar (const u16 *pixelData, u16 pixelsPerRow, MutableBitmapBase *bitmap, u16 colour, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)=0

Protected Attributes

u8 _height
u8 _first
u8 _last
const u16 * _glyphData
const u16 * _glyphOffset
const u8 * _glyphWidth
u8 _fontWidth
u8 _spWidth
u8 _fontTop
u8 _widMax

Detailed Description

PackedFont is a base class defining a font whose data is packed into a more efficient data format.


Constructor & Destructor Documentation

WoopsiGfx::PackedFontBase::PackedFontBase ( u8  first,
u8  last,
const u16 *  glyphData,
const u16 *  glyphOffset,
const u8 *  glyphWidth,
const u8  height,
const u8  spWidth,
const u8  fontTop,
const u8  fixedWidth = 0 
) [inline]

Constructor.

Parameters:
firstAscii index of first character in glphyDdata.
lastAscii index of last character in glyphData.
glyphDataPacked array representing font.
glyphOffsetOffset into glyphData[] of character[i].
glyphWidthPixel width of character[i].
heightThe height of the font.
spWidthThe width of a space character.
fontTopThe height of the font minus the blank spaces below 'a'.
fixedWidthCharacter width (fixed), or 0 for proportional.

Member Function Documentation

virtual s16 WoopsiGfx::PackedFontBase::drawBaselineChar ( MutableBitmapBase bitmap,
u32  letter,
u16  colour,
s16  x,
s16  y,
u16  clipX1,
u16  clipY1,
u16  clipX2,
u16  clipY2 
) [inline, 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.
colourThe colour to draw with. If this is 0 the font's default colour will be used.
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.

Implements WoopsiGfx::FontBase.

s16 PackedFontBase::drawChar ( MutableBitmapBase bitmap,
u32  letter,
u16  colour,
s16  x,
s16  y,
u16  clipX1,
u16  clipY1,
u16  clipX2,
u16  clipY2 
) [virtual]

Draw an individual character of the font to the specified bitmap.

Parameters:
bitmapThe bitmap to draw to.
letterThe character to output.
colourThe colour to draw with. If this is 0 the font's default colour will be used.
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.

Implements WoopsiGfx::FontBase.

virtual u8 WoopsiGfx::PackedFontBase::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.

Implements WoopsiGfx::FontBase.

virtual s8 WoopsiGfx::PackedFontBase::getCharTop ( u32  letter) const [inline, virtual]

Get the top of an individual character (constant for a packedfont).

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

Implements WoopsiGfx::FontBase.

u8 PackedFontBase::getCharWidth ( u32  letter) const [virtual]

Get the width of an individual character.

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

Implements WoopsiGfx::FontBase.

const u8 WoopsiGfx::PackedFontBase::getHeight ( ) const [inline, virtual]

Gets the height of the font.

Returns:
The height of the font.

Implements WoopsiGfx::FontBase.

u16 PackedFontBase::getStringWidth ( const WoopsiString text) const [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.

Implements WoopsiGfx::FontBase.

u16 PackedFontBase::getStringWidth ( const WoopsiString text,
s32  startIndex,
s32  length 
) const [virtual]

Get the width of a portion of a string 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:
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.

Implements WoopsiGfx::FontBase.

const bool PackedFontBase::isCharBlank ( const u32  letter) const [virtual]

Text uses this to decide whether a given character is blank or not

Implements WoopsiGfx::FontBase.

virtual void WoopsiGfx::PackedFontBase::renderChar ( const u16 *  pixelData,
u16  pixelsPerRow,
MutableBitmapBase bitmap,
u16  colour,
s16  x,
s16  y,
u16  clipX1,
u16  clipY1,
u16  clipX2,
u16  clipY2 
) [pure virtual]

Render an individual character of the font to the specified bitmap.

Parameters:
pixelDataThe font-specific pixel data.
pixelsPerRowThe number of pixels to render per row (for this character).
bitmapThe bitmap to draw to.
colourThe colour to draw with. If this is 0 the font's default colour will be used.
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.

Implemented in WoopsiGfx::PackedFont1, and WoopsiGfx::PackedFont16.

void WoopsiGfx::PackedFontBase::setFontWidth ( u8  fontWidth) [inline]

Makes this font fixed-width, though doesn't allow the spacing to be less than the font's known maximum character width. If you want fixed spacing but don't know the required size, pass 1.

Parameters:
fontWidthFont width to use (0 for proportional, 1 for wide-enough).

Member Data Documentation

The first letter that the font contains.

Constant Top of the packed font.

Width of the font, or 0 for proportional.

const u16* WoopsiGfx::PackedFontBase::_glyphData [protected]

All data for each glyph.

Locations of each character in _glyphData.

Width in pixels of each glyph in _glyphData.

The height of the font.

The last letter that the font contains.

Width of a blank space.

The maximum width of a character in the font.


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