1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

FontEditor: Allow application to launch without a font

Since LibFSAC requires a reified window before loading a font, it
makes sense to have a safe null state for the app.

This lets us stay alive after a failed file request on startup,
handle failure at any point during initialization, and claw back
memory from all our font RefPtrs.

A default startup font or none at all can now be set in FontEditor.ini
This commit is contained in:
thankyouverycool 2023-05-10 17:01:28 -04:00 committed by Andreas Kling
parent aaf60053f1
commit 7fa8fae786
5 changed files with 127 additions and 20 deletions

View file

@ -29,6 +29,9 @@ public:
virtual ~MainWidget() override = default;
void show_error(Error, StringView action, StringView basename = {});
void reset();
ErrorOr<void> initialize(StringView path, RefPtr<Gfx::BitmapFont>&&);
ErrorOr<void> initialize_menubar(GUI::Window&);
@ -61,6 +64,8 @@ private:
void update_title();
void set_scale_and_save(i32);
void set_actions_enabled(bool);
void set_widgets_enabled(bool);
ErrorOr<void> copy_selected_glyphs();
ErrorOr<void> cut_selected_glyphs();
@ -70,8 +75,6 @@ private:
void push_undo();
void reset_selection_and_push_undo();
void show_error(Error, StringView action, StringView basename = {});
RefPtr<GUI::GlyphMapWidget> m_glyph_map_widget;
RefPtr<GlyphEditorWidget> m_glyph_editor_widget;
@ -122,6 +125,7 @@ private:
RefPtr<GUI::Statusbar> m_statusbar;
RefPtr<GUI::ToolbarContainer> m_toolbar_container;
RefPtr<GUI::Widget> m_unicode_block_container;
RefPtr<GUI::Widget> m_width_control_container;
RefPtr<GUI::ComboBox> m_weight_combobox;
RefPtr<GUI::ComboBox> m_slope_combobox;
RefPtr<GUI::SpinBox> m_spacing_spinbox;
@ -150,6 +154,7 @@ private:
Vector<String> m_font_slope_list;
Vector<String> m_unicode_block_list;
Unicode::CodePointRange m_range { 0x0000, 0x10FFFF };
bool m_initialized { false };
};
}