summaryrefslogtreecommitdiff
path: root/include/JSystem/JUtility/JUTResFont.h
blob: 77047933b4ed4cab5ffa691d3628283c5b519c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef JUTRESFONT_H
#define JUTRESFONT_H

#include "JSystem/JUtility/JUTFont.h"
#include "dolphin/gx/GXEnum.h"

class JKRHeap;

typedef bool (*IsLeadByte_func)(int);

class JUTResFont : public JUTFont {
public:
    virtual ~JUTResFont();
    virtual void setGX();
    virtual void setGX(JUtility::TColor, JUtility::TColor);
    virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool);
    virtual const ResFONT* getResFont() const { return mResFont; }
    virtual int getFontType() const { return mInfoBlock->fontType; }
    virtual int getLeading() const { return mInfoBlock->leading; }
    virtual s32 getWidth() const { return mInfoBlock->width; }
    virtual s32 getAscent() const { return mInfoBlock->ascent; }
    virtual s32 getDescent() const { return mInfoBlock->descent; }
    virtual s32 getHeight() const { return getAscent() + getDescent(); }
    virtual void getWidthEntry(int, JUTFont::TWidth*) const;
    virtual int getCellWidth() const;
    virtual s32 getCellHeight() const;
    virtual bool isLeadByte(int) const;
    virtual void loadImage(int, GXTexMapID);
    virtual void setBlock();

    JUTResFont(ResFONT const*, JKRHeap*);
    JUTResFont();
    void deleteMemBlocks_ResFont();
    void initialize_state();
    bool initiate(ResFONT const*, JKRHeap*);
    bool protected_initiate(ResFONT const*, JKRHeap*);
    void countBlock();
    void loadFont(int, GXTexMapID, JUTFont::TWidth*);
    int getFontCode(int) const;
    int convertSjis(int, u16*) const;

    inline void delete_and_initialize() {
        deleteMemBlocks_ResFont();
        initialize_state();
    }

    static const int suAboutEncoding_ = 3;
    static IsLeadByte_func const saoAboutEncoding_[suAboutEncoding_];

    /* 0x1C */ int mWidth;
    /* 0x20 */ int mHeight;
    /* 0x24 */ GXTexObj mTexObj;
    /* 0x44 */ int mTexPageIdx;
    /* 0x48 */ const ResFONT* mResFont;
    /* 0x4C */ ResFONT::INF1* mInfoBlock;
    /* 0x50 */ void** mpMemBlocks;
    /* 0x54 */ ResFONT::WID1** mpWidthBlocks;
    /* 0x58 */ ResFONT::GLY1** mpGlyphBlocks;
    /* 0x5C */ ResFONT::MAP1** mpMapBlocks;
    /* 0x60 */ u16 mWidthBlockNum;
    /* 0x62 */ u16 mGlyphBlockNum;
    /* 0x64 */ u16 mMapBlockNum;
    /* 0x66 */ u16 field_0x66;
    /* 0x68 */ u16 mMaxCode;
    /* 0x6C */ const IsLeadByte_func* mIsLeadByte;
};

#endif /* JUTRESFONT_H */