Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text rotation #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ let package = Package(
name: "SVGView",
path: "Source",
exclude: ["Info.plist"]
),
.testTarget(
name: "SVGViewTests",
dependencies: ["SVGView"],
path: "SVGViewTests",
resources: [.copy("w3c")]
)
],
swiftLanguageVersions: [.v5]
Expand Down
2 changes: 1 addition & 1 deletion SVGViewTests/BaseTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BaseTestCase : XCTestCase {
}

func compareToReference(_ fileName: String) {
let bundle = Bundle(for: type(of: self))
let bundle = Bundle.module
let svgURL = bundle.url(forResource: fileName, withExtension: "svg", subdirectory: "w3c/\(dir)/svg/")!
let refURL = bundle.url(forResource: fileName, withExtension: "ref", subdirectory: "w3c/\(dir)/refs/")!

Expand Down
2 changes: 1 addition & 1 deletion SVGViewTests/SVGRefGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class SVGRefGenerator: XCTestCase {
}

func createReference(name: String, version: String) {
let bundle = Bundle(for: type(of: self))
let bundle = Bundle.module
let url = bundle.url(forResource: name, withExtension: "svg", subdirectory: version)!
let versionNumber = String(version.split(separator: "/")[1])
let testDirectory = getTestDir(version: versionNumber)
Expand Down
1 change: 1 addition & 0 deletions Source/Model/Nodes/SVGText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct SVGTextView: View {
.alignmentGuide(VerticalAlignment.top) { d in d[VerticalAlignment.firstTextBaseline] }
.position(x: 0, y: 0) // just to specify that positioning is global, actual coords are in transform
.apply(paint: fill)
.frame(alignment: .topLeading)
.transformEffect(model.transform)
.frame(alignment: .topLeading)
}
Expand Down