- Main Page
- Classes
- Files

- File List

# packedfontbase.h

    00001 /* Contributed by Jeff Laing
    00002  * 20080414
    00003  */
    00004
    00005 #ifndef _PACKED_FONT_BASE_
    00006 #define _PACKED_FONT_BASE_
    00007
    00008 #include <nds.h>
    00009 #include "fontbase.h"
    00010
    00011 namespace WoopsiUI {
    00012
    00017         class PackedFontBase : public FontBase
    00018         {
    00019         public:
    00031                 PackedFontBase(
    00032                         u8 first, u8 last,
    00033                         const u16 *glyphData,
    00034                         const u16 *glyphOffset,
    00035                         const u8 *glyphWidth,
    00036                         const u8 height,
    00037                         const u8 spWidth,
    00038                         const u8 fixedWidth = 0)
    00039                         :
    00040                           FontBase(height, 0),
    00041                           _first(first), _last(last),
    00042                           _glyphData(glyphData), _glyphOffset(glyphOffset), _glyphWidth(glyphWidth),
    00043                           _fontWidth(0),
    00044                           _spWidth(spWidth), _widMax(fixedWidth) { };
    00045
    00052                 inline void setFontWidth(u8 fontWidth) { _fontWidth = (fontWidth && (fontWidth < _widMax)) ? _widMax : fontWidth; };
    00053
    00066                 virtual s16 drawChar(
    00067                         MutableBitmapBase* bitmap,
    00068                         u32 letter,
    00069                         s16 x, s16 y,
    00070                         u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2);
    00071
    00077                 virtual u16 getStringWidth(const WoopsiString& text) const;
    00078
    00088                 virtual u16 getStringWidth(const WoopsiString& text, s32 startIndex, s32 length) const;
    00089
    00095                 virtual u16 getCharWidth(u32 letter) const;
    00096
    00100                 const bool isCharBlank(const u32 letter) const;
    00101
    00114                 virtual void renderChar(
    00115                         const u16* pixelData, u16 pixelsPerRow,
    00116                         MutableBitmapBase* bitmap,
    00117                         s16 x, s16 y,
    00118                         u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2) = 0;
    00119
    00120         protected:
    00121                 u8 _first;
    00122                 u8 _last;
    00123                 const u16 *_glyphData;
    00124                 const u16 *_glyphOffset;
    00125                 const u8 *_glyphWidth;
    00126                 u8 _fontWidth;
    00127                 u8 _spWidth;
    00128                 u8 _widMax;
    00129         };
    00130 }
    00131
    00132 #endif