Conversion pipeline: Do not error out on books that set font size to zero. Fixes #898194 (Private bug)

This commit is contained in:
Kovid Goyal 2011-11-30 21:33:00 +05:30
parent 5943156eaa
commit b2bea092fc
2 changed files with 6 additions and 2 deletions

View File

@ -539,7 +539,8 @@ class Style(object):
'Return value in pts' 'Return value in pts'
if base is None: if base is None:
base = self.width base = self.width
font = font or self.fontSize if not font and font != 0:
font = self.fontSize
return unit_convert(value, base, font, self._profile.dpi) return unit_convert(value, base, font, self._profile.dpi)
def pt_to_px(self, value): def pt_to_px(self, value):

View File

@ -283,7 +283,10 @@ class CSSFlattener(object):
psize = fsize psize = fsize
elif 'font-size' in cssdict or tag == 'body': elif 'font-size' in cssdict or tag == 'body':
fsize = self.fmap[font_size] fsize = self.fmap[font_size]
try:
cssdict['font-size'] = "%0.5fem" % (fsize / psize) cssdict['font-size'] = "%0.5fem" % (fsize / psize)
except ZeroDivisionError:
cssdict['font-size'] = '%.1fpt'%fsize
psize = fsize psize = fsize
try: try: