1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

FontEditor: Convert to GML and add new edit commands to GlyphEditor

Adds cut, copy, paste and delete to GlyphEditor. Font preview has
moved to a separate resizable ToolWindow. Font metadata can now be
hidden. FontEditor and glyph widgets can now be re-initialized
instead of resetting window's main widget after loading new fonts.
This commit is contained in:
thankyouverycool 2021-04-06 12:04:21 -04:00 committed by Andreas Kling
parent d115b29a5b
commit bb9cd13a56
7 changed files with 477 additions and 241 deletions

View file

@ -35,9 +35,17 @@ class GlyphEditorWidget final : public GUI::Frame {
public:
virtual ~GlyphEditorWidget() override;
void initialize(Gfx::BitmapFont&);
int glyph() const { return m_glyph; }
void set_glyph(int);
void cut_glyph();
void copy_glyph();
void paste_glyph();
void delete_glyph();
void clear_clipboard_glyph();
int preferred_width() const;
int preferred_height() const;
@ -47,7 +55,7 @@ public:
Function<void(u8)> on_glyph_altered;
private:
GlyphEditorWidget(Gfx::BitmapFont&);
GlyphEditorWidget() {};
virtual void paint_event(GUI::PaintEvent&) override;
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
@ -55,6 +63,8 @@ private:
void draw_at_mouse(const GUI::MouseEvent&);
RefPtr<Gfx::BitmapFont> m_font;
RefPtr<Gfx::Font> m_clipboard_font;
Gfx::GlyphBitmap m_clipboard_glyph;
int m_glyph { 0 };
int m_scale { 10 };
};