mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
TextEditor: Save the selected font
This commit is contained in:
parent
c90024fbab
commit
0ce854cf73
Notes:
sideshowbarker
2024-07-17 10:05:47 +09:00
Author: https://github.com/moustafaraafat Commit: https://github.com/SerenityOS/serenity/commit/0ce854cf73 Pull-request: https://github.com/SerenityOS/serenity/pull/15766 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 5 additions and 0 deletions
|
@ -64,6 +64,10 @@ MainWidget::MainWidget()
|
|||
else
|
||||
VERIFY_NOT_REACHED();
|
||||
|
||||
auto font_entry = Config::read_string("TextEditor"sv, "Text"sv, "Font"sv, "default"sv);
|
||||
if (font_entry != "default")
|
||||
m_editor->set_font(Gfx::FontDatabase::the().get_by_name(font_entry));
|
||||
|
||||
m_editor->on_change = Core::debounce([this] {
|
||||
update_preview();
|
||||
},
|
||||
|
@ -436,6 +440,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
if (picker->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
dbgln("setting font {}", picker->font()->qualified_name());
|
||||
m_editor->set_font(picker->font());
|
||||
Config::write_string("TextEditor"sv, "Text"sv, "Font"sv, picker->font()->qualified_name());
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
Loading…
Reference in a new issue