Skip to content

Commit

Permalink
Merge pull request #97 from BlackFoundryCom/fix-issue94
Browse files Browse the repository at this point in the history
Fix SVG clip path transform
  • Loading branch information
justvanrossum authored Jun 9, 2022
2 parents 5538aab + 5775a71 commit 82d64a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Lib/blackrenderer/backends/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def _addElement(self, fillPath, fillTransform, paint, gradientTransform):
logger.warning(
"SVG canvas does not support more than two nested clip paths"
)
if clipTransform is not None:
clipTransform = fillTransform.inverse().transform(clipTransform)
self.elements.append(
(fillPath, fillTransform, clipPath, clipTransform, paint, gradientTransform)
)
Expand Down Expand Up @@ -280,7 +282,7 @@ def writeSVGElements(elements, viewBox, stream):
attrs.append(("fill", f"url(#{gradients[paint, paintT]})"))
attrs.append(("transform", formatMatrix(fillT)))
if clipPath is not None:
clipKey = clipPath, clipTransform
clipKey = clipPath, clipT
attrs.append(("clip-path", f"url(#{clipPaths[clipKey]})"))
ET.SubElement(root, "path", dict(attrs))

Expand Down
4 changes: 2 additions & 2 deletions Tests/expectedOutput/glyph_nested_paintglyph_A_svg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 82d64a4

Please sign in to comment.