mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix handling of line-height
This commit is contained in:
parent
79bbd29900
commit
20e8cd127d
@ -1182,9 +1182,17 @@ class HTMLConverter(object):
|
|||||||
fp['parindent'] = indent
|
fp['parindent'] = indent
|
||||||
|
|
||||||
if tag_css.has_key('line-height'):
|
if tag_css.has_key('line-height'):
|
||||||
val = self.unit_convert(tag_css['line-height'], pts=True, base_length='1pt')
|
bls, ls = int(self.current_block.textStyle.attrs['baselineskip']), \
|
||||||
|
int(self.current_block.textStyle.attrs['linespace'])
|
||||||
|
try: # See if line-height is a unitless number
|
||||||
|
val = int(float(tag_css['line-height'].strip()) * (bls+ls))
|
||||||
|
fp['linespace'] = val
|
||||||
|
except ValueError:
|
||||||
|
val = self.unit_convert(tag_css['line-height'], pts=True, base_length='1pt')
|
||||||
if val is not None:
|
if val is not None:
|
||||||
fp['linespace'] = val
|
val -= bls
|
||||||
|
if val >= 0:
|
||||||
|
fp['linespace'] = val
|
||||||
|
|
||||||
return fp
|
return fp
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user