Skip to content

Commit

Permalink
Fix rem font size for SVG images
Browse files Browse the repository at this point in the history
SVG pictures can have font size in rem
  • Loading branch information
anikinmd committed Oct 27, 2022
1 parent 66e1656 commit 0de8df6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions weasyprint/svg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 0de8df6

Please sign in to comment.