summaryrefslogtreecommitdiff
path: root/include/nw4r/ut/ut_RomFont.h
blob: b312969ff30811f1eb99d6b873ad8468da685a47 (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
#ifndef NW4R_UT_ROM_FONT_H
#define NW4R_UT_ROM_FONT_H
#include "nw4r/types_nw4r.h"
#include "nw4r/ut/ut_Font.h"
#include "rvl/OS.h" // IWYU pragma: export

namespace nw4r {
namespace ut {

class RomFont : public Font {
public:
    RomFont();
    virtual ~RomFont(); // at 0x8

    virtual int GetWidth() const;                                // at 0xC
    virtual int GetHeight() const;                               // at 0x10
    virtual int GetAscent() const;                               // at 0x14
    virtual int GetDescent() const;                              // at 0x18
    virtual int GetBaselinePos() const;                          // at 0x1C
    virtual int GetCellHeight() const;                           // at 0x20
    virtual int GetCellWidth() const;                            // at 0x24
    virtual int GetMaxCharWidth() const;                         // at 0x28
    virtual Type GetType() const;                                // at 0x2C
    virtual GXTexFmt GetTextureFormat() const;                   // at 0x30
    virtual int GetLineFeed() const;                             // at 0x34
    virtual CharWidths GetDefaultCharWidths() const;             // at 0x38
    virtual void SetDefaultCharWidths(const CharWidths &widths); // at 0x3C
    virtual bool SetAlternateChar(u16 c);                        // at 0x40
    virtual void SetLineFeed(int lf);                            // at 0x44
    virtual int GetCharWidth(u16 c) const;                       // at 0x48
    virtual CharWidths GetCharWidths(u16 c) const;               // at 0x4C
    virtual void GetGlyph(Glyph *out, u16 c) const;              // at 0x50
    virtual bool HasGlyph(u16 c) const;                          // at 0x54
    virtual FontEncoding GetEncoding() const;                    // at 0x58

    bool Load(void *buffer);
    u32 GetRequireBufferSize();
    void MakeCharPtr(char *buffer, u16 c) const;
    u16 HandleUndefinedChar(u16 c) const;

private:
    OSFontHeader *mFontHeader; // at 0x10
    CharWidths mDefaultWidths; // at 0x14
    u16 mAlternateChar;        // at 0x18

    static u16 mFontEncode;
};

} // namespace ut
} // namespace nw4r

#endif