Viewer: Fix using a very small font step size not working. Fixes #1888609 [If I reduce font size below 10, then keyboard shortcut to increase font size stops working](https://bugs.launchpad.net/calibre/+bug/1888609)

This commit is contained in:
Kovid Goyal 2020-07-30 13:42:09 +05:30
parent 252d6dacec
commit 22acded7a2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -49,6 +49,8 @@ def change_font_size_by(frac):
sd = get_session_data() sd = get_session_data()
sz = sd.get('base_font_size') sz = sd.get('base_font_size')
amt = sz * frac amt = sz * frac
if abs(amt) < 1:
amt = -1 if amt < 0 else 1
nsz = int(sz + amt) nsz = int(sz + amt)
nsz = max(MIN_FONT_SIZE, min(nsz, MAX_FONT_SIZE)) nsz = max(MIN_FONT_SIZE, min(nsz, MAX_FONT_SIZE))
change_font_size(nsz) change_font_size(nsz)