From 20e8cd127db12e1b12d04fdda6b38efef7c8a4da Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 30 Oct 2007 21:18:21 +0000 Subject: [PATCH] Fix handling of line-height --- src/libprs500/ebooks/lrf/html/convert_from.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libprs500/ebooks/lrf/html/convert_from.py b/src/libprs500/ebooks/lrf/html/convert_from.py index 12cb357895..792f660291 100644 --- a/src/libprs500/ebooks/lrf/html/convert_from.py +++ b/src/libprs500/ebooks/lrf/html/convert_from.py @@ -1182,9 +1182,17 @@ class HTMLConverter(object): fp['parindent'] = indent 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: - fp['linespace'] = val + val -= bls + if val >= 0: + fp['linespace'] = val return fp