diff --git a/src/pyj/read_book/prefs/font_size.pyj b/src/pyj/read_book/prefs/font_size.pyj index 40ebe2e33c..3f23ceb1fe 100644 --- a/src/pyj/read_book/prefs/font_size.pyj +++ b/src/pyj/read_book/prefs/font_size.pyj @@ -10,6 +10,7 @@ from dom import add_extra_css, rule, unique_id from read_book.globals import ui_operations from widgets import create_button +from session import defaults CONTAINER = unique_id('font-size-prefs') MIN_FONT_SIZE = 8 @@ -56,6 +57,10 @@ def change_font_size_by(frac): change_font_size(nsz) +def restore_default_font_size(): + change_font_size(defaults.base_font_size) + + def display_changed_font_size(sz): sz = max(MIN_FONT_SIZE, min(int(sz), MAX_FONT_SIZE)) sz += '' diff --git a/src/pyj/read_book/shortcuts.pyj b/src/pyj/read_book/shortcuts.pyj index 2c955c220d..f92b33b20d 100644 --- a/src/pyj/read_book/shortcuts.pyj +++ b/src/pyj/read_book/shortcuts.pyj @@ -248,6 +248,12 @@ def common_shortcuts(): # {{{ _('Decrease font size'), ), + 'default_font_size': desc( + "Ctrl+0", + 'ui', + _('Restore default font size'), + ), + 'increase_number_of_columns': desc( v"['Ctrl+]']", 'ui', diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index b0bd0bc799..97765cce85 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -26,7 +26,7 @@ from read_book.open_book import add_book_to_recently_viewed from read_book.overlay import Overlay from read_book.prefs.colors import resolve_color_scheme -from read_book.prefs.font_size import change_font_size_by +from read_book.prefs.font_size import change_font_size_by, restore_default_font_size from read_book.prefs.fonts import current_zoom_step_size from read_book.prefs.head_foot import render_head_foot from read_book.prefs.scrolling import ( @@ -521,6 +521,8 @@ def on_handle_shortcut(self, data): self.bump_font_size({'increase': True}) elif data.name is 'decrease_font_size': self.bump_font_size({'increase': False}) + elif data.name is 'default_font_size': + restore_default_font_size() elif data.name is 'toggle_full_screen': ui_operations.toggle_full_screen() elif data.name is 'toggle_reference_mode':