diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-04-18 14:31:39 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-04-18 18:57:35 +0200 |
commit | 60f82e06260417d6c808db8199913567276078c7 (patch) | |
tree | f26054fee921878bec84a68e3465ab800930b26a /Userland/Applications | |
parent | f461ee7d01d3a1e040579519351912cd546d1d20 (diff) | |
download | serenity-60f82e06260417d6c808db8199913567276078c7.zip |
FontEditor: Update GlyphMap on font type change
Since font type changes also change the amount of glyphs in a font, the
glyph map has to be re-rendered to properly showcase the change.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/FontEditor/FontEditor.cpp | 1 | ||||
-rw-r--r-- | Userland/Applications/FontEditor/GlyphMapWidget.cpp | 8 | ||||
-rw-r--r-- | Userland/Applications/FontEditor/GlyphMapWidget.h | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index cb1f712dfb..5887d93199 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -288,6 +288,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& m_type_combobox->on_change = [this](auto&, const auto& index) { m_edited_font->set_type(static_cast<Gfx::FontTypes>(index.row())); + m_glyph_map_widget->reprobe_font(); }; m_presentation_spinbox->on_change = [this, update_demo](int value) { diff --git a/Userland/Applications/FontEditor/GlyphMapWidget.cpp b/Userland/Applications/FontEditor/GlyphMapWidget.cpp index b115472718..c03302f93e 100644 --- a/Userland/Applications/FontEditor/GlyphMapWidget.cpp +++ b/Userland/Applications/FontEditor/GlyphMapWidget.cpp @@ -90,6 +90,14 @@ void GlyphMapWidget::update_glyph(int glyph) update(get_outer_rect(glyph)); } +void GlyphMapWidget::reprobe_font() +{ + VERIFY(m_font); + m_glyph_count = m_font->glyph_count(); + m_selected_glyph = 0; + update(); +} + void GlyphMapWidget::paint_event(GUI::PaintEvent& event) { GUI::Frame::paint_event(event); diff --git a/Userland/Applications/FontEditor/GlyphMapWidget.h b/Userland/Applications/FontEditor/GlyphMapWidget.h index 3c6a683c32..1fb2ccc5d3 100644 --- a/Userland/Applications/FontEditor/GlyphMapWidget.h +++ b/Userland/Applications/FontEditor/GlyphMapWidget.h @@ -47,6 +47,7 @@ public: const Gfx::BitmapFont& font() const { return *m_font; } void update_glyph(int); + void reprobe_font(); Function<void(int)> on_glyph_selected; |