summaryrefslogtreecommitdiff
path: root/Widgets/Font.h
blob: 6d62ccf979f417de376bbe620011231ba765afcb (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
#pragma once

#include "CBitmap.h"
#include <AK/Retainable.h>
#include <AK/RetainPtr.h>
#include <AK/Types.h>

class Font : public Retainable<Font> {
public:
    static Font& defaultFont();

    ~Font();

    const CBitmap* glyphBitmap(byte) const;

    byte glyphWidth() const { return m_glyphWidth; }
    byte glyphHeight() const { return m_glyphHeight; }

private:
    Font(const char* const* glyphs, byte glyphWidth, byte glyphHeight, byte firstGlyph, byte lastGlyph);

    const char* const* m_glyphs { nullptr };
    mutable RetainPtr<CBitmap> m_bitmaps[256];

    byte m_glyphWidth { 0 };
    byte m_glyphHeight { 0 };

    byte m_firstGlyph { 0 };
    byte m_lastGlyph { 0 };
};