mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
FontEditor: Improve error handling opening, saving and editing fonts
Adds fallible functions for opening and saving fonts and cutting and copying selections. FontEditor now falls back on a guaranteed default BitmapFont on startup. Fixes crashing on start when the default system font is set to TrueType.
This commit is contained in:
parent
e9a150c87c
commit
807bd6da6c
Notes:
sideshowbarker
2024-07-17 10:54:57 +09:00
Author: https://github.com/thankyouverycool
Commit: 807bd6da6c
Pull-request: https://github.com/SerenityOS/serenity/pull/14736
Reviewed-by: https://github.com/krkk
3 changed files with 35 additions and 40 deletions
|
@ -46,11 +46,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(font_editor->initialize_menubar(*window));
|
||||
|
||||
if (path) {
|
||||
auto success = font_editor->open_file(path);
|
||||
if (!success)
|
||||
return 1;
|
||||
TRY(font_editor->open_file(path));
|
||||
} else {
|
||||
auto mutable_font = static_ptr_cast<Gfx::BitmapFont>(Gfx::FontDatabase::default_font().clone())->unmasked_character_set();
|
||||
auto mutable_font = TRY(TRY(Gfx::BitmapFont::try_load_from_file("/res/fonts/KaticaRegular10.font"))->unmasked_character_set());
|
||||
TRY(font_editor->initialize({}, move(mutable_font)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue