- Main Page
- Classes
- Files

- File List

# freetypefont.h

    00001 #ifndef _FREETYPE_FONT_H_
    00002 #define _FREETYPE_FONT_H_
    00003
    00004 #include <nds.h>
    00005 #include "fontbase.h"
    00006
    00007 #include "ft2build.h"
    00008 #include FT_FREETYPE_H
    00009 #include FT_CACHE_H
    00010 #include FT_BITMAP_H
    00011
    00012 #include "freetypefacemanager.h"
    00013
    00014 namespace WoopsiUI {
    00015
    00016         class MutableBitmapBase;
    00017         class FreeTypeCache;
    00018
    00022         class FreeTypeFont : public FontBase {
    00023         public:
    00024
    00033                 FreeTypeFont(const FreeTypeCache* fontCache, const FaceID* faceID, const u8 width, const u8 height, const u16 colour);
    00034
    00038                 inline ~FreeTypeFont() {};
    00039
    00044                 void getSbit(const u32 codepoint) const;
    00045
    00051                 inline u16 getCharWidth(const u32 codepoint) const {
    00052                         getSbit(codepoint);
    00053                         return (u16) _sbit->xadvance;
    00054                 };
    00055
    00061                 inline u16 getStringWidth(const WoopsiString& text) const;
    00062
    00072                 inline u16 getStringWidth(const WoopsiString& text, s32 startIndex, s32 length) const;
    00073
    00080                 virtual inline const bool isCharBlank(const u32 codepoint) const {
    00081                         getSbit(codepoint);
    00082                         if ((_sbit->buffer == 0) || (_sbit->width == 0) || (_sbit->height == 0)) return true;
    00083                         return false;
    00084                 };
    00085
    00098                 s16 drawChar(MutableBitmapBase* bitmap, u32 letter, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2);
    00099
    00100         private:
    00101                 const FreeTypeCache* _fontCache;
    00102                 const FaceID* _faceID;
    00103                 u32 _charMapIndex;
    00104                 FTC_ScalerRec _scaler;
    00105                 FTC_SBit _sbit;
    00106         };
    00107 }
    00108
    00109 #endif