#include <packedfontbase.h>
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 fixedWidth=0) | |
| void | setFontWidth (u8 fontWidth) |
| virtual s16 | drawChar (MutableBitmapBase *bitmap, u32 letter, 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 u16 | getCharWidth (u32 letter) const |
| const bool | isCharBlank (const u32 letter) const |
| virtual void | renderChar (const u16 *pixelData, u16 pixelsPerRow, MutableBitmapBase *bitmap, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)=0 |
Protected Attributes | |
| u8 | _first |
| u8 | _last |
| const u16 * | _glyphData |
| const u16 * | _glyphOffset |
| const u8 * | _glyphWidth |
| u8 | _fontWidth |
| u8 | _spWidth |
| u8 | _widMax |
PackedFont is a base class defining a font whose data is packed into a more efficient data format.
| WoopsiUI::PackedFontBase::PackedFontBase | ( | u8 | first, | |
| u8 | last, | |||
| const u16 * | glyphData, | |||
| const u16 * | glyphOffset, | |||
| const u8 * | glyphWidth, | |||
| const u8 | height, | |||
| const u8 | spWidth, | |||
| const u8 | fixedWidth = 0 | |||
| ) | [inline] |
Constructor.
| first | Ascii index of first character in glphyDdata. | |
| last | Ascii index of last character in glyphData. | |
| glyphData | Packed array representing font. | |
| glyphOffset | Offset into glyphData[] of character[i]. | |
| glyphWidth | Pixel width of character[i]. | |
| height | The height of the font. | |
| spWidth | The width of a space character | |
| fixedWidth | Character width (fixed), or 0 for proportional. |
| virtual s16 WoopsiUI::PackedFontBase::drawChar | ( | MutableBitmapBase * | bitmap, | |
| u32 | letter, | |||
| s16 | x, | |||
| s16 | y, | |||
| u16 | clipX1, | |||
| u16 | clipY1, | |||
| u16 | clipX2, | |||
| u16 | clipY2 | |||
| ) | [virtual] |
Draw an individual character of the font to the specified bitmap.
| bitmap | The bitmap to draw 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. |
Implements WoopsiUI::FontBase.
| virtual u16 WoopsiUI::PackedFontBase::getCharWidth | ( | u32 | letter | ) | const [virtual] |
Get the width of an individual character.
| letter | The character to get the width of. |
Implements WoopsiUI::FontBase.
| virtual u16 WoopsiUI::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.
| text | The string to check. | |
| startIndex | The start point of the substring within the string. | |
| length | The length of the substring in chars. |
Implements WoopsiUI::FontBase.
| virtual u16 WoopsiUI::PackedFontBase::getStringWidth | ( | const WoopsiString & | text | ) | const [virtual] |
Get the width of a string in pixels when drawn with this font.
| text | The string to check. |
Implements WoopsiUI::FontBase.
| const bool WoopsiUI::PackedFontBase::isCharBlank | ( | const u32 | letter | ) | const [virtual] |
Text uses this to decide whether a given character is blank or not
Implements WoopsiUI::FontBase.
| virtual void WoopsiUI::PackedFontBase::renderChar | ( | const u16 * | pixelData, | |
| u16 | pixelsPerRow, | |||
| MutableBitmapBase * | bitmap, | |||
| 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.
| pixelData | The font-specific pixel data | |
| pixelsPerRow | The number of pixels to render per row (for this character) | |
| bitmap | The bitmap to draw to. | |
| 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. |
Implemented in WoopsiUI::PackedFont1, and WoopsiUI::PackedFont16.
| void WoopsiUI::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.
| fontWidth | Font width to use (0 for proportional, 1 for wide-enough) |
u8 WoopsiUI::PackedFontBase::_first [protected] |
The first letter that the font contains
u8 WoopsiUI::PackedFontBase::_fontWidth [protected] |
Width of the font, or 0 for proportional
const u16* WoopsiUI::PackedFontBase::_glyphData [protected] |
All data for each glyph
const u16* WoopsiUI::PackedFontBase::_glyphOffset [protected] |
Locations of each character in _glyphData
const u8* WoopsiUI::PackedFontBase::_glyphWidth [protected] |
Width in pixels of each glyph in _glyphData
u8 WoopsiUI::PackedFontBase::_last [protected] |
The last letter that the font contains
u8 WoopsiUI::PackedFontBase::_spWidth [protected] |
Width of a blank space
u8 WoopsiUI::PackedFontBase::_widMax [protected] |
The maximum width of a character in the font
1.6.3