Skip to content

Commit

Permalink
Merge branch '62.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed May 30, 2024
2 parents 4d2f932 + ff2acf1 commit a8ed5c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions weasyprint/svg/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ def draw_gradient(svg, node, gradient, font_size, opacity, stroke):
bx2, by2 = transform_matrix.invert.transform_point(width, height)
width, height = bx2 - bx1, by2 - by1

# Ensure that width and height are positive to please some PDF readers
if bx1 > bx2:
width = -width
bx1, bx2 = bx2, bx1
if by1 > by2:
height = -height
by1, by2 = by2, by1

pattern = svg.stream.add_pattern(
bx1, by1, width, height, width, height, matrix @ svg.stream.ctm)
group = pattern.add_group(bx1, by1, width, height)
Expand Down

0 comments on commit a8ed5c1

Please sign in to comment.