Skip to content

Commit

Permalink
fixed incorrect initializers for non-macOS platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
frzi committed Dec 6, 2023
1 parent a1de23e commit 9ff07c1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Sources/VariableFonts/VariableFonts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ public extension PlatformFont {
let descriptor = Self.descriptorFor(name: fontName, axes: [
id: value
])
#if os(macOS)
return Self.init(descriptor: descriptor, size: pointSize)!
#else
return Self.init(descriptor: descriptor, size: pointSize)
#endif
}

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

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

/// Returns a new font with the applied axex, using the name as key.
Expand All @@ -96,7 +108,11 @@ public extension PlatformFont {
return (nameToId(key), value)
})
let descriptor = Self.descriptorFor(name: fontName, axes: axes)
#if os(macOS)
return Self.init(descriptor: descriptor, size: pointSize)!
#else
return Self.init(descriptor: descriptor, size: pointSize)
#endif
}
}

Expand Down

0 comments on commit 9ff07c1

Please sign in to comment.