2018-10-12 00:45:57 +03:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-10 07:41:49 +03:00
|
|
|
#include "CharacterBitmap.h"
|
2018-10-12 00:45:57 +03:00
|
|
|
#include <AK/Retainable.h>
|
2018-10-12 13:49:45 +03:00
|
|
|
#include <AK/RetainPtr.h>
|
2018-10-12 00:45:57 +03:00
|
|
|
#include <AK/Types.h>
|
|
|
|
|
|
|
|
class Font : public Retainable<Font> {
|
|
|
|
public:
|
2019-01-16 19:54:06 +03:00
|
|
|
static Font& default_font();
|
2018-10-12 00:45:57 +03:00
|
|
|
|
|
|
|
~Font();
|
|
|
|
|
2019-01-27 07:14:15 +03:00
|
|
|
const CharacterBitmap& glyph_bitmap(char ch) const { return *m_bitmaps[(byte)ch]; }
|
2018-10-12 00:45:57 +03:00
|
|
|
|
2019-01-16 19:54:06 +03:00
|
|
|
byte glyph_width() const { return m_glyph_width; }
|
|
|
|
byte glyph_height() const { return m_glyph_height; }
|
2018-10-12 00:45:57 +03:00
|
|
|
|
2019-01-11 01:19:29 +03:00
|
|
|
static void initialize();
|
|
|
|
|
2018-10-12 00:45:57 +03:00
|
|
|
private:
|
2019-01-16 19:54:06 +03:00
|
|
|
Font(const char* const* glyphs, byte glyph_width, byte glyph_height, byte firstGlyph, byte lastGlyph);
|
2018-10-12 00:45:57 +03:00
|
|
|
|
|
|
|
const char* const* m_glyphs { nullptr };
|
2019-01-10 07:41:49 +03:00
|
|
|
mutable RetainPtr<CharacterBitmap> m_bitmaps[256];
|
2019-01-23 10:07:58 +03:00
|
|
|
RetainPtr<CharacterBitmap> m_error_bitmap;
|
2018-10-12 00:45:57 +03:00
|
|
|
|
2019-01-16 19:54:06 +03:00
|
|
|
byte m_glyph_width { 0 };
|
|
|
|
byte m_glyph_height { 0 };
|
2018-10-12 00:45:57 +03:00
|
|
|
|
2019-01-16 19:54:06 +03:00
|
|
|
byte m_first_glyph { 0 };
|
|
|
|
byte m_last_glyph { 0 };
|
2018-10-12 00:45:57 +03:00
|
|
|
};
|