From 0de8df66212e0b5ba81faf1eb5d9c209cc6baa0f Mon Sep 17 00:00:00 2001 From: Mikhail Anikin Date: Thu, 27 Oct 2022 15:14:14 +0300 Subject: [PATCH] Fix rem font size for SVG images SVG pictures can have font size in rem --- weasyprint/svg/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weasyprint/svg/utils.py b/weasyprint/svg/utils.py index 30ec9a923b..c43f05b80f 100644 --- a/weasyprint/svg/utils.py +++ b/weasyprint/svg/utils.py @@ -38,6 +38,9 @@ def size(string, font_size=None, percentage_reference=None): if string.endswith('%'): assert percentage_reference is not None return float(string[:-1]) * percentage_reference / 100 + elif string.endswith('rem'): + assert font_size is not None + return font_size * float(string[:-3]) elif string.endswith('em'): assert font_size is not None return font_size * float(string[:-2])