Skip to content

Commit 31fbd6f

Browse files
committed
Preference Fill over stroke
1 parent 8b570ad commit 31fbd6f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Samples/chart.svg

Lines changed: 4 additions & 0 deletions
Loading

SwiftDraw/Renderer.SFSymbol.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ extension SFSymbolRenderer {
6767
fill: LayerTree.FillAttributes) -> LayerTree.Path? {
6868
guard case .path(let p) = shape else { return nil }
6969

70+
if fill.fill != .none && fill.opacity > 0 {
71+
return p
72+
}
73+
7074
if stoke.color != .none && stoke.width > 0 {
7175
#if canImport(CoreGraphics)
7276
return expandOutlines(for: p, stroke: stoke)
@@ -76,10 +80,6 @@ extension SFSymbolRenderer {
7680
#endif
7781
}
7882

79-
if fill.fill != .none && fill.opacity > 0 {
80-
return p
81-
}
82-
8383
return nil
8484
}
8585

SwiftDrawTests/Renderer.SFSymbolTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class RendererSFSymbolTests: XCTestCase {
3939
}
4040

4141
func testSymbol() throws {
42-
let url = try Bundle.test.url(forResource: "key.svg")
42+
let url = try Bundle.test.url(forResource: "chart.svg")
4343
let svg = try SFSymbolRenderer.render(fileURL: url, options: [])
4444
XCTAssertTrue(svg.contains("Ultralight-S"))
4545
XCTAssertTrue(svg.contains("Regular-S"))

0 commit comments

Comments
 (0)