@@ -195,16 +195,17 @@ extension SFSymbolRenderer {
195195 for c in layer. contents {
196196 switch c {
197197 case let . shape( shape, stroke, fill) :
198- if let path = makePath ( for: shape,
199- stoke: stroke,
200- fill: fill,
201- preserve: isSFSymbolLayer) ? . applying ( matrix: ctm) {
198+
199+ if let fillPath = makeFillPath ( for: shape, fill: fill, preserve: isSFSymbolLayer) {
202200 if fill. rule == . evenodd {
203- paths. append ( SymbolPath ( class: symbolClass, path: path . makeNonZero ( ) ) )
201+ paths. append ( SymbolPath ( class: symbolClass, path: fillPath . applying ( matrix : ctm ) . makeNonZero ( ) ) )
204202 } else {
205- paths. append ( SymbolPath ( class: symbolClass, path: path ) )
203+ paths. append ( SymbolPath ( class: symbolClass, path: fillPath . applying ( matrix : ctm ) ) )
206204 }
205+ } else if let strokePath = makeStrokePath ( for: shape, stroke: stroke, preserve: isSFSymbolLayer) {
206+ paths. append ( SymbolPath ( class: symbolClass, path: strokePath. applying ( matrix: ctm) ) )
207207 }
208+
208209 case let . text( text, point, attributes) :
209210 if let path = makePath ( for: text, at: point, with: attributes) {
210211 paths. append ( SymbolPath ( class: symbolClass, path: path. applying ( matrix: ctm) ) )
@@ -219,18 +220,21 @@ extension SFSymbolRenderer {
219220 return paths
220221 }
221222
222- static func makePath( for shape: LayerTree . Shape ,
223- stoke: LayerTree . StrokeAttributes ,
224- fill: LayerTree . FillAttributes ,
225- preserve: Bool ) -> LayerTree . Path ? {
226-
223+ static func makeFillPath( for shape: LayerTree . Shape ,
224+ fill: LayerTree . FillAttributes ,
225+ preserve: Bool ) -> LayerTree . Path ? {
227226 if preserve || ( fill. fill != . none && fill. opacity > 0 ) {
228227 return shape. path
229228 }
229+ return nil
230+ }
230231
231- if preserve || ( stoke. color != . none && stoke. width > 0 ) {
232+ static func makeStrokePath( for shape: LayerTree . Shape ,
233+ stroke: LayerTree . StrokeAttributes ,
234+ preserve: Bool ) -> LayerTree . Path ? {
235+ if preserve || ( stroke. color != . none && stroke. width > 0 ) {
232236#if canImport(CoreGraphics)
233- return expandOutlines ( for: shape. path, stroke: stoke )
237+ return expandOutlines ( for: shape. path, stroke: stroke )
234238#else
235239 print ( " Warning: " , " expanding stroke outlines requires macOS. " , to: & . standardError)
236240 return nil
0 commit comments