mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Revert #572
This commit is contained in:
parent
bce8b75095
commit
44e08bbdff
@ -1132,9 +1132,11 @@ class HTMLConverter(object):
|
|||||||
return key
|
return key
|
||||||
|
|
||||||
def font_size(val):
|
def font_size(val):
|
||||||
|
'''
|
||||||
|
Assumes 1em=100%=10pt
|
||||||
|
'''
|
||||||
normal = int(self.current_block.textStyle.attrs['fontsize'])
|
normal = int(self.current_block.textStyle.attrs['fontsize'])
|
||||||
normpts = str(normal/10) + 'pt'
|
ans = self.unit_convert(val, pts=True, base_length='10pt')
|
||||||
ans = self.unit_convert(val, pts=True, base_length=normpts)
|
|
||||||
|
|
||||||
if ans:
|
if ans:
|
||||||
if ans <= 0:
|
if ans <= 0:
|
||||||
@ -1246,11 +1248,10 @@ class HTMLConverter(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
m = re.search(r"\s*(-*[0-9]*\.?[0-9]*)\s*(%|em|px|mm|cm|in|dpt|pt|pc)", val)
|
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):
|
if m is not None and m.group(1):
|
||||||
unit = float(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
|
result = (unit/100.0) * normal
|
||||||
elif m.group(2) == 'px':
|
elif m.group(2) == 'px':
|
||||||
result = unit
|
result = unit
|
||||||
@ -1261,8 +1262,7 @@ class HTMLConverter(object):
|
|||||||
elif m.group(2) == 'dpt':
|
elif m.group(2) == 'dpt':
|
||||||
result = unit * dpi/720.
|
result = unit * dpi/720.
|
||||||
elif m.group(2) == 'em':
|
elif m.group(2) == 'em':
|
||||||
normal = int(self.current_block.textStyle.attrs['fontsize'])
|
result = unit * normal
|
||||||
result = unit * normal * (dpi/720.)
|
|
||||||
elif m.group(2) == 'pc':
|
elif m.group(2) == 'pc':
|
||||||
result = unit * (dpi/72.) * 12
|
result = unit * (dpi/72.) * 12
|
||||||
elif m.group(2) == 'mm':
|
elif m.group(2) == 'mm':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user