From a2f6803a53de21b0ea3b0f9c915a1c3da2fec8f3 Mon Sep 17 00:00:00 2001 From: Benedikt Terhechte Date: Thu, 28 May 2020 10:13:31 +0200 Subject: [PATCH] Allow initializing `Font` with `NSFont` or `UIFont` --- Sources/Splash/Theming/Font.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Splash/Theming/Font.swift b/Sources/Splash/Theming/Font.swift index a06f5be..3d2df2d 100644 --- a/Sources/Splash/Theming/Font.swift +++ b/Sources/Splash/Theming/Font.swift @@ -31,6 +31,12 @@ public struct Font { resource = .system self.size = size } + + /// Initialize an instance with an existing, custom, font. + public init(font: Loaded) { + resource = .preloaded(font) + self.size = font.pointSize + } } public extension Font {