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,9 +62,17 @@ 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 == 0:
|
try:
|
||||||
logb = 1e-6
|
result = sign * math.log(diff, logb)
|
||||||
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
|
return result
|
||||||
|
|
||||||
def __getitem__(self, ssize):
|
def __getitem__(self, ssize):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user