Skip to content

Commit 82d64a4

Browse files
Merge pull request #97 from BlackFoundryCom/fix-issue94
Fix SVG clip path transform
2 parents 5538aab + 5775a71 commit 82d64a4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Lib/blackrenderer/backends/svg.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def _addElement(self, fillPath, fillTransform, paint, gradientTransform):
136136
logger.warning(
137137
"SVG canvas does not support more than two nested clip paths"
138138
)
139+
if clipTransform is not None:
140+
clipTransform = fillTransform.inverse().transform(clipTransform)
139141
self.elements.append(
140142
(fillPath, fillTransform, clipPath, clipTransform, paint, gradientTransform)
141143
)
@@ -280,7 +282,7 @@ def writeSVGElements(elements, viewBox, stream):
280282
attrs.append(("fill", f"url(#{gradients[paint, paintT]})"))
281283
attrs.append(("transform", formatMatrix(fillT)))
282284
if clipPath is not None:
283-
clipKey = clipPath, clipTransform
285+
clipKey = clipPath, clipT
284286
attrs.append(("clip-path", f"url(#{clipPaths[clipKey]})"))
285287
ET.SubElement(root, "path", dict(attrs))
286288

Tests/expectedOutput/glyph_nested_paintglyph_A_svg.svg

+2-2
Loading

0 commit comments

Comments
 (0)