Skip to content

Commit

Permalink
Follow hint when only output_width or output_height is set
Browse files Browse the repository at this point in the history
When only one of the two sizes is given, the other one is defined according to
the intrinsic ratio.

Fix #164.
  • Loading branch information
liZe committed Nov 23, 2020
1 parent 6b4f2ba commit 83c0b83
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cairosvg/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ def __init__(self, tree, output, dpi, parent_surface=None,

if output_width and output_height:
width, height = output_width, output_height
elif output_width:
if width:
height *= output_width / width
width = output_width
elif output_height:
if height:
width *= output_height / height
height = output_height
else:
width *= scale
height *= scale
Expand Down

0 comments on commit 83c0b83

Please sign in to comment.