libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
basicfont.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
13#include <promeki/font.h>
14#include <promeki/buffer.h>
15
16PROMEKI_NAMESPACE_BEGIN
17
56class BasicFont : public Font {
57 public:
62 BasicFont(const PaintEngine &pe);
63
65 ~BasicFont() override;
66
67 bool drawText(const String &text, int x, int y) override;
68 int measureText(const String &text) override;
69 int lineHeight() override;
70 int ascender() override;
71 int descender() override;
72
73 protected:
74 void onStateChanged() override;
75
76 private:
77 bool ensureFontLoaded();
78 void releaseFont();
79
80 void *_ftLibrary = nullptr;
81 void *_ftFace = nullptr;
82 Buffer _fontData;
83 int _ascender = 0;
84 int _descender = 0;
85 int _lineHeight = 0;
86 bool _fontDirty = true;
87};
88
89PROMEKI_NAMESPACE_END
90
91#endif // PROMEKI_ENABLE_PROAV