Make relative line height handling similar to em font size handling

This commit is contained in:
Kovid Goyal 2008-03-15 20:43:28 +00:00
parent a68ed12218
commit 73b14d9884

View File

@ -1286,8 +1286,8 @@ class HTMLConverter(object):
fp['parindent'] = indent fp['parindent'] = indent
if tag_css.has_key('line-height'): if tag_css.has_key('line-height'):
bls, ls = int(self.current_block.textStyle.attrs['baselineskip']), \ bls, ls = int(self.book.defaultTextStyle.attrs['baselineskip']), \
int(self.current_block.textStyle.attrs['linespace']) int(self.book.defaultTextStyle.attrs['linespace'])
try: # See if line-height is a unitless number try: # See if line-height is a unitless number
val = int(float(tag_css['line-height'].strip()) * (bls+ls)) val = int(float(tag_css['line-height'].strip()) * (bls+ls))
fp['linespace'] = val fp['linespace'] = val
@ -1331,7 +1331,7 @@ class HTMLConverter(object):
if properties_different(self.current_block.blockStyle.attrs, block_properties) or \ if properties_different(self.current_block.blockStyle.attrs, block_properties) or \
properties_different(self.current_block.textStyle.attrs, text_properties) or\ properties_different(self.current_block.textStyle.attrs, text_properties) or\
align != self.current_block.textStyle.attrs['align']: align != self.current_block.textStyle.attrs['align']:
ts = self.current_block.textStyle.copy() ts = self.current_block.textStyle.copy()
ts.attrs.update(text_properties) ts.attrs.update(text_properties)
ts.attrs['align'] = align ts.attrs['align'] = align
bs = self.current_block.blockStyle.copy() bs = self.current_block.blockStyle.copy()