1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

LibGfx: Introduce provisional font interface

Old font functionality has been moved into BitmapFont
and an abstract Font interface has been introduced to
faciliate further development of TTF font integration.
This commit is contained in:
Stephan Unverwerth 2020-12-31 14:01:59 +01:00 committed by Andreas Kling
parent ac50bc79e4
commit bb27b212de
13 changed files with 542 additions and 416 deletions

View file

@ -28,6 +28,7 @@
#include <AK/Function.h>
#include <LibGUI/Frame.h>
#include <LibGfx/BitmapFont.h>
class GlyphEditorWidget final : public GUI::Frame {
C_OBJECT(GlyphEditorWidget)
@ -40,20 +41,20 @@ public:
int preferred_width() const;
int preferred_height() const;
Gfx::Font& font() { return *m_font; }
const Gfx::Font& font() const { return *m_font; }
Gfx::BitmapFont& font() { return *m_font; }
const Gfx::BitmapFont& font() const { return *m_font; }
Function<void(u8)> on_glyph_altered;
private:
GlyphEditorWidget(Gfx::Font&);
GlyphEditorWidget(Gfx::BitmapFont&);
virtual void paint_event(GUI::PaintEvent&) override;
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
void draw_at_mouse(const GUI::MouseEvent&);
RefPtr<Gfx::Font> m_font;
RefPtr<Gfx::BitmapFont> m_font;
int m_glyph { 0 };
int m_scale { 10 };
};