diff --git a/src/pyj/read_book/paged_mode.pyj b/src/pyj/read_book/paged_mode.pyj index 9db51a3ba5..3b417a6b2e 100644 --- a/src/pyj/read_book/paged_mode.pyj +++ b/src/pyj/read_book/paged_mode.pyj @@ -152,18 +152,21 @@ def cps_by_em_size(): ans = cps_by_em_size.ans fs = window.getComputedStyle(document.body).fontSize if not ans or cps_by_em_size.at_font_size is not fs: - d = document.createElement('span') - d.style.position = 'absolute' - d.style.visibility = 'hidden' - d.style.width = '1rem' - d.style.fontSize = '1rem' - d.style.paddingTop = d.style.paddingBottom = d.style.paddingLeft = d.style.paddingRight = '0' - d.style.marginTop = d.style.marginBottom = d.style.marginLeft = d.style.marginRight = '0' - d.style.borderStyle = 'none' - document.body.appendChild(d) - w = d.clientWidth - document.body.removeChild(d) - ans = cps_by_em_size.ans = max(2, w) + if fs is 0: + ans = cps_by_em_size.ans = 16 + else: + d = document.createElement('span') + d.style.position = 'absolute' + d.style.visibility = 'hidden' + d.style.width = '1rem' + d.style.fontSize = '1rem' + d.style.paddingTop = d.style.paddingBottom = d.style.paddingLeft = d.style.paddingRight = '0' + d.style.marginTop = d.style.marginBottom = d.style.marginLeft = d.style.marginRight = '0' + d.style.borderStyle = 'none' + document.body.appendChild(d) + w = d.clientWidth + document.body.removeChild(d) + ans = cps_by_em_size.ans = max(2, w) cps_by_em_size.at_font_size = fs return ans