From b96602b35099c7fd16df5e9bc8941eae40c61601 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Feb 2016 18:29:41 +0530 Subject: [PATCH] Conversion pipeline: Add support for the q unit --- src/calibre/ebooks/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index ce368254ce..28b0288b4e 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -239,7 +239,7 @@ def calibre_cover(title, author_string, series_string=None, if cleanup: 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): ' Return value in pts' @@ -277,6 +277,8 @@ def unit_convert(value, base, font, dpi, body_font_size=12): result = value * 28.346456693 elif unit == 'rem': result = value * body_font_size + elif unit == 'q': + result = value * 0.708661417325 return result def parse_css_length(value):