improves plak

This commit is contained in:
2026-10-17 17:33:13 +02:00
parent 7b891819b0
commit a92d6f8871
633 changed files with 17623 additions and 7556 deletions
+7 -1
View File
@@ -1,14 +1,20 @@
import AppKit
/// OpenDyslexic for all text; the system font when the bundled face is missing.
/// OpenDyslexic for text, OpenDyslexic Mono for code and tables; a system font when a bundled face is missing.
public enum PlakFonts {
public static let regular = "OpenDyslexic-Regular"
public static let monoRegular = "OpenDyslexicMono-Regular"
public static func body(_ size: CGFloat) -> NSFont {
FontRegistry.registerBundledFonts()
return NSFont(name: regular, size: size) ?? .systemFont(ofSize: size)
}
public static func mono(_ size: CGFloat) -> NSFont {
FontRegistry.registerBundledFonts()
return NSFont(name: monoRegular, size: size) ?? .monospacedSystemFont(ofSize: size, weight: .regular)
}
/// 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)