This commit is contained in:
Kovid Goyal 2008-03-15 19:59:49 +00:00
parent 44e08bbdff
commit 0e18d26960

View File

@ -1248,10 +1248,11 @@ class HTMLConverter(object):
except ValueError:
pass
m = re.search(r"\s*(-*[0-9]*\.?[0-9]*)\s*(%|em|px|mm|cm|in|dpt|pt|pc)", val)
normal = self.unit_convert(base_length)
if m is not None and m.group(1):
unit = float(m.group(1))
if m.group(2) == '%':
if m.group(2) == '%':
normal = self.unit_convert(base_length)
result = (unit/100.0) * normal
elif m.group(2) == 'px':
result = unit
@ -1262,6 +1263,7 @@ class HTMLConverter(object):
elif m.group(2) == 'dpt':
result = unit * dpi/720.
elif m.group(2) == 'em':
normal = self.unit_convert(base_length)
result = unit * normal
elif m.group(2) == 'pc':
result = unit * (dpi/72.) * 12