diff --git a/Package.swift b/Package.swift index f909916..4c78632 100644 --- a/Package.swift +++ b/Package.swift @@ -6,14 +6,22 @@ let package = Package( products: [ .library( name: "Cairo", - targets: ["Cairo"]), + targets: ["Cairo"] + ) + ], + dependencies: [ + .package( + url: "https://github.com/PureSwift/FontConfig.git", + branch: "master" + ) ], targets: [ .target( name: "Cairo", dependencies: [ "CCairo", - "CFreeType" + "CFreeType", + "FontConfig" ] ), .testTarget( diff --git a/Sources/Cairo/Font.swift b/Sources/Cairo/Font.swift index f5e2b6d..99c3191 100755 --- a/Sources/Cairo/Font.swift +++ b/Sources/Cairo/Font.swift @@ -8,6 +8,7 @@ import CCairo import CFreeType +import FontConfig public final class ScaledFont { @@ -266,8 +267,8 @@ public final class FontFace { cairo_font_face_destroy(internalPointer) } - public init(fontConfigPattern: OpaquePointer) { - self.internalPointer = cairo_ft_font_face_create_for_pattern(fontConfigPattern)! + public init(pattern: FontConfig.Pattern) { + self.internalPointer = pattern.withUnsafePointer(cairo_ft_font_face_create_for_pattern)! } internal init(_ internalPointer: OpaquePointer) {