diff --git a/src/pyj/read_book/flow_mode.pyj b/src/pyj/read_book/flow_mode.pyj index 5393728c24..b50a7f7dfa 100644 --- a/src/pyj/read_book/flow_mode.pyj +++ b/src/pyj/read_book/flow_mode.pyj @@ -12,7 +12,13 @@ from utils import document_height, viewport_to_document def line_height(): - return parseFloat(line_height.doc_style.lineHeight) + try: + # will fail if line-height = "normal" + lh = parseFloat(line_height.doc_style.lineHeight) + except: + lh = 1.2 * parseFloat(line_height.doc_style.fontSize) + + return lh def flow_to_scroll_fraction(frac, on_initial_load): scroll_viewport.scroll_to(0, document_height() * frac) diff --git a/src/pyj/read_book/settings.pyj b/src/pyj/read_book/settings.pyj index adfb516d6d..0c5defb9dd 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -9,7 +9,7 @@ from session import defaults opts = {} def update_settings(settings): - settings = settings or defaults + settings = Object.assign({}, defaults, settings) opts.base_font_size = max(8, min(settings.base_font_size, 64)) opts.bg_image_fade = settings.bg_image_fade or 'transparent' opts.color_scheme = settings.color_scheme