Skip to content

Commit 9ff07c1

Browse files
committed
fixed incorrect initializers for non-macOS platforms
1 parent a1de23e commit 9ff07c1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Sources/VariableFonts/VariableFonts.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ public extension PlatformFont {
7272
let descriptor = Self.descriptorFor(name: fontName, axes: [
7373
id: value
7474
])
75+
#if os(macOS)
7576
return Self.init(descriptor: descriptor, size: pointSize)!
77+
#else
78+
return Self.init(descriptor: descriptor, size: pointSize)
79+
#endif
7680
}
7781

7882
/// Returns a new font with the applied axis, using the name as key.
@@ -81,13 +85,21 @@ public extension PlatformFont {
8185
let descriptor = Self.descriptorFor(name: fontName, axes: [
8286
id: value
8387
])
88+
#if os(macOS)
8489
return Self.init(descriptor: descriptor, size: pointSize)!
90+
#else
91+
return Self.init(descriptor: descriptor, size: pointSize)
92+
#endif
8593
}
8694

8795
/// Returns a new font with the applied axex, using the identifier as key.
8896
func withAxes(_ axes: [UInt32 : CGFloat]) -> Self {
8997
let descriptor = Self.descriptorFor(name: fontName, axes: axes)
98+
#if os(macOS)
9099
return Self.init(descriptor: descriptor, size: pointSize)!
100+
#else
101+
return Self.init(descriptor: descriptor, size: pointSize)
102+
#endif
91103
}
92104

93105
/// Returns a new font with the applied axex, using the name as key.
@@ -96,7 +108,11 @@ public extension PlatformFont {
96108
return (nameToId(key), value)
97109
})
98110
let descriptor = Self.descriptorFor(name: fontName, axes: axes)
111+
#if os(macOS)
99112
return Self.init(descriptor: descriptor, size: pointSize)!
113+
#else
114+
return Self.init(descriptor: descriptor, size: pointSize)
115+
#endif
100116
}
101117
}
102118

0 commit comments

Comments
 (0)