mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
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.
This commit is contained in:
parent
f461ee7d01
commit
60f82e0626
3 changed files with 10 additions and 0 deletions
|
@ -288,6 +288,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
|
||||||
|
|
||||||
m_type_combobox->on_change = [this](auto&, const auto& index) {
|
m_type_combobox->on_change = [this](auto&, const auto& index) {
|
||||||
m_edited_font->set_type(static_cast<Gfx::FontTypes>(index.row()));
|
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) {
|
m_presentation_spinbox->on_change = [this, update_demo](int value) {
|
||||||
|
|
|
@ -90,6 +90,14 @@ void GlyphMapWidget::update_glyph(int glyph)
|
||||||
update(get_outer_rect(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)
|
void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
|
||||||
{
|
{
|
||||||
GUI::Frame::paint_event(event);
|
GUI::Frame::paint_event(event);
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
const Gfx::BitmapFont& font() const { return *m_font; }
|
const Gfx::BitmapFont& font() const { return *m_font; }
|
||||||
|
|
||||||
void update_glyph(int);
|
void update_glyph(int);
|
||||||
|
void reprobe_font();
|
||||||
|
|
||||||
Function<void(int)> on_glyph_selected;
|
Function<void(int)> on_glyph_selected;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue