mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion: Handle input documents with crazy font sizes (1000pt +)
This commit is contained in:
parent
1fd7e6ae55
commit
787184f15b
@ -62,8 +62,16 @@ class KeyMapper(object):
|
||||
endp = 0 if size < base else 36
|
||||
diff = (abs(base - size) * 3) + ((36 - size) / 100)
|
||||
logb = abs(base - endp)
|
||||
try:
|
||||
result = sign * math.log(diff, logb)
|
||||
except ValueError:
|
||||
if diff < 0:
|
||||
# Size is both very large and close to base
|
||||
return 0
|
||||
if logb == 0:
|
||||
logb = 1e-6
|
||||
if diff == 0:
|
||||
diff = 1e-6
|
||||
result = sign * math.log(diff, logb)
|
||||
return result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user