1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 11:08: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

@ -29,6 +29,7 @@
#include <AK/Function.h>
#include <AK/StdLibExtras.h>
#include <LibGUI/Frame.h>
#include <LibGfx/BitmapFont.h>
class GlyphMapWidget final : public GUI::Frame {
C_OBJECT(GlyphMapWidget)
@ -44,22 +45,22 @@ 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; }
void update_glyph(int);
Function<void(int)> on_glyph_selected;
private:
explicit GlyphMapWidget(Gfx::Font&);
explicit GlyphMapWidget(Gfx::BitmapFont&);
virtual void paint_event(GUI::PaintEvent&) override;
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void keydown_event(GUI::KeyEvent&) override;
Gfx::IntRect get_outer_rect(int glyph) const;
RefPtr<Gfx::Font> m_font;
RefPtr<Gfx::BitmapFont> m_font;
int m_glyph_count;
int m_columns { 32 };
int m_horizontal_spacing { 2 };