mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 17:34:04 +02:00
Revert #572
This commit is contained in:
parent
44e08bbdff
commit
0e18d26960
1 changed files with 4 additions and 2 deletions
|
|
@ -1248,10 +1248,11 @@ def unit_convert(self, val, pts=False, base_length='10pt'):
|
|||
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 @@ def unit_convert(self, val, pts=False, base_length='10pt'):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue