Processing of images should call process_alignment

This commit is contained in:
Kovid Goyal 2007-05-15 14:00:59 +00:00
parent 61c7035c3f
commit 32088f598b

View File

@ -392,7 +392,11 @@ class HTMLConverter(object):
temp = {} temp = {}
for key in pcss.keys(): for key in pcss.keys():
chk = key.lower() chk = key.lower()
if chk.startswith('font') or chk == 'text-align': # float should not be inherited according to the CSS spec
# however we need to as we don't do alignment at a block level.
# float is removed by the process_alignment function.
if chk.startswith('font') or chk == 'text-align' or \
chk == 'float':
temp[key] = pcss[key] temp[key] = pcss[key]
prop.update(temp) prop.update(temp)
@ -635,7 +639,14 @@ class HTMLConverter(object):
if val in ["right", "foot"]: if val in ["right", "foot"]:
align = "foot" align = "foot"
elif val == "center": elif val == "center":
align = "center" align = "center"
if css.has_key('float'):
val = css['float'].lower()
if val == 'left':
align = 'head'
if val == 'right':
align = 'foot'
css.pop('float')
if align != self.current_block.textStyle.attrs['align']: if align != self.current_block.textStyle.attrs['align']:
self.current_para.append_to(self.current_block) self.current_para.append_to(self.current_block)
self.current_block.append_to(self.current_page) self.current_block.append_to(self.current_page)
@ -824,6 +835,9 @@ class HTMLConverter(object):
if not self.images.has_key(path): if not self.images.has_key(path):
self.images[path] = ImageStream(path) self.images[path] = ImageStream(path)
factor = 720./self.profile.dpi factor = 720./self.profile.dpi
self.process_alignment(tag_css)
if max(width, height) <= min(self.profile.page_width, if max(width, height) <= min(self.profile.page_width,
self.profile.page_height)/5.: self.profile.page_height)/5.:
im = Image(self.images[path], x0=0, y0=0, x1=width, y1=height,\ im = Image(self.images[path], x0=0, y0=0, x1=width, y1=height,\