import AppKit /// IBM Plex Mono for the page, code, tables, bookmark lines and the bookmark index, IBM Plex Sans for the banner; the system fonts when Plex is missing. public enum PlakFonts { public static func body(_ size: CGFloat) -> NSFont { FontRegistry.registerBundledFonts() return NSFont(name: "IBMPlexSans-Regular", size: size) ?? NSFont.systemFont(ofSize: size) } public static func mono(_ size: CGFloat) -> NSFont { FontRegistry.registerBundledFonts() return NSFont(name: "IBMPlexMono-Regular", size: size) ?? NSFont.monospacedSystemFont(ofSize: size, weight: .regular) } /// IBM Plex Mono Bold (700), the boldest bundled mono weight. public static func monoBold(_ size: CGFloat) -> NSFont { FontRegistry.registerBundledFonts() return NSFont(name: "IBMPlexMono-Bold", size: size) ?? NSFont.monospacedSystemFont(ofSize: size, weight: .bold) } /// The height of one line of this font with no paragraph style. static func naturalLineHeight(_ font: NSFont) -> CGFloat { ceil(font.ascender - font.descender + font.leading) } }