mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New PDF engine: Ignore dive by zero when average char width is zero
This commit is contained in:
parent
59661ebb28
commit
c1c8a81227
@ -990,7 +990,10 @@ class Page:
|
|||||||
frag.indented = 1 # 1em
|
frag.indented = 1 # 1em
|
||||||
else: # Assume left margin of approx = number of chars
|
else: # Assume left margin of approx = number of chars
|
||||||
# Should check for values approx the same, as with indents
|
# Should check for values approx the same, as with indents
|
||||||
frag.margin_left = int(round((frag.left - left) / frag.average_character_width)+0.5)
|
try:
|
||||||
|
frag.margin_left = int(round((frag.left - left) / frag.average_character_width)+0.5)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
frag.margin_left = 0
|
||||||
if last_frag is not None \
|
if last_frag is not None \
|
||||||
and frag.bottom - last_frag.bottom \
|
and frag.bottom - last_frag.bottom \
|
||||||
> stats.para_space*SECTION_FACTOR:
|
> stats.para_space*SECTION_FACTOR:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user