Conversion: Fix error when input document contains a font size exactly one point away from the base size. Fixes #1472291 [Convert from HTM to mobi](https://bugs.launchpad.net/calibre/+bug/1472291)

This commit is contained in:
Kovid Goyal 2015-07-08 10:55:46 +05:30
parent 9bce68c323
commit d707a4778f

View File

@ -62,6 +62,8 @@ class KeyMapper(object):
endp = 0 if size < base else 36 endp = 0 if size < base else 36
diff = (abs(base - size) * 3) + ((36 - size) / 100) diff = (abs(base - size) * 3) + ((36 - size) / 100)
logb = abs(base - endp) logb = abs(base - endp)
if logb == 1.0:
logb = 1.1
try: try:
result = sign * math.log(diff, logb) result = sign * math.log(diff, logb)
except ValueError: except ValueError: