Viewer: Fix font size changes not applying to monospaced fonts. Fixes #1876580 [Re: calibre bug 1875021 (Viewer: Some font size cannot be influenced by A+ or A-)](https://bugs.launchpad.net/calibre/+bug/1876580)

This commit is contained in:
Kovid Goyal 2020-05-03 20:03:44 +05:30
parent 4c06764684
commit 2af560fe8a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -317,6 +317,7 @@ def apply_font_settings(page_or_view):
s.setFontFamily(s.StandardFont, s.fontFamily(sf))
old_minimum = s.fontSize(s.MinimumFontSize)
old_base = s.fontSize(s.DefaultFontSize)
old_fixed_base = s.fontSize(s.DefaultFixedFontSize)
mfs = fs.get('minimum_font_size')
if mfs is None:
s.resetFontSize(s.MinimumFontSize)
@ -325,8 +326,10 @@ def apply_font_settings(page_or_view):
bfs = sd.get('base_font_size')
if bfs is not None:
s.setFontSize(s.DefaultFontSize, bfs)
s.setFontSize(s.DefaultFixedFontSize, int(bfs * 13 / 16))
font_size_changed = old_minimum != s.fontSize(s.MinimumFontSize) or old_base != s.fontSize(s.DefaultFontSize)
font_size_changed = (old_minimum, old_base, old_fixed_base) != (
s.fontSize(s.MinimumFontSize), s.fontSize(s.DefaultFontSize), s.fontSize(s.DefaultFixedFontSize))
if font_size_changed and hasattr(page_or_view, 'execute_when_ready'):
page_or_view.execute_when_ready('viewer_font_size_changed')