mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion pipeline: Add support for the q unit
This commit is contained in:
parent
0d5341a31b
commit
b96602b350
@ -239,7 +239,7 @@ def calibre_cover(title, author_string, series_string=None,
|
|||||||
if cleanup:
|
if cleanup:
|
||||||
os.remove(font_path)
|
os.remove(font_path)
|
||||||
|
|
||||||
UNIT_RE = re.compile(r'^(-*[0-9]*[.]?[0-9]*)\s*(%|em|ex|en|px|mm|cm|in|pt|pc|rem)$')
|
UNIT_RE = re.compile(r'^(-*[0-9]*[.]?[0-9]*)\s*(%|em|ex|en|px|mm|cm|in|pt|pc|rem|q)$')
|
||||||
|
|
||||||
def unit_convert(value, base, font, dpi, body_font_size=12):
|
def unit_convert(value, base, font, dpi, body_font_size=12):
|
||||||
' Return value in pts'
|
' Return value in pts'
|
||||||
@ -277,6 +277,8 @@ def unit_convert(value, base, font, dpi, body_font_size=12):
|
|||||||
result = value * 28.346456693
|
result = value * 28.346456693
|
||||||
elif unit == 'rem':
|
elif unit == 'rem':
|
||||||
result = value * body_font_size
|
result = value * body_font_size
|
||||||
|
elif unit == 'q':
|
||||||
|
result = value * 0.708661417325
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def parse_css_length(value):
|
def parse_css_length(value):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user