Critique-directed polish of the reading surface (#72 ruling: pipeline calm, surface not-calm) plus the single-user typography rework: - Flow: leading 1.5, paragraph gap tightened; heading ladder rescaled (h1 1.15x / h2 0.85x / h3 body-face semibold) with cling margins, hN+hN suppression, no title dead space - Constructs: confident blockquote (near-ink text, 3px rail, nesting degrades), booktabs tables, tinted code panels, relative inline code - Fonts hardcoded for Alexander's faces: Valkyrie OT B 17 body, Concourse OT Semibold headings, UbuntuMono 14 code; 66ch measure - Stylesheet moved to Museion/Resources/reading.css, read fresh per page build — Debug builds load the repo copy (#filePath), so CSS edits hot-reload on the next reading toggle - Settings Typography/Text Flow sections and all flow-key plumbing deleted (56 insertions, 417 deletions) Refs #72, #78. Detector: 192 findings -> 0. Build + 93 tests green. [Generated by AI]
75 lines
2.5 KiB
Swift
75 lines
2.5 KiB
Swift
//
|
|
// ProseTypography.swift
|
|
// Museion
|
|
//
|
|
// #72 rework: single-user app — the prose typography is hardcoded constants,
|
|
// dialled in on Alexander's exact fonts (Valkyrie OT B body / Concourse OT
|
|
// headings / UbuntuMono code). The Settings typography/flow sections are
|
|
// gone; the reading surface's look lives in Museion/Resources/reading.css
|
|
// (editable while the app runs). These constants feed the EDITING surface;
|
|
// the CSS :root block is the source of truth for reading.
|
|
//
|
|
|
|
import AppKit
|
|
|
|
/// Prose typography constants (#72 rework). The editing surface reads these;
|
|
/// reading mode reads Resources/reading.css.
|
|
nonisolated enum ProseTypography {
|
|
/// Body = Valkyrie OT B (the screen cut; CoreText unifies the OT family
|
|
/// as "Valkyrie OT" — only B members installed, no A/B ambiguity).
|
|
static var bodyFont: NSFont { NSFont(name: "ValkyrieOTBRegular", size: 17) ?? NSFont.systemFont(ofSize: 17) }
|
|
|
|
/// Headings = Concourse OT (the designer's own pairing with Valkyrie);
|
|
/// Semibold carries heading weight better than Book on screen.
|
|
static var headingFont: NSFont { NSFont(name: "ConcourseOT6Semibold", size: 26) ?? NSFont.systemFont(ofSize: 26, weight: .semibold) }
|
|
|
|
/// Code slot (inline code, fenced blocks, editing syntax dim).
|
|
static var codeFont: NSFont { NSFont(name: "UbuntuMonoNFM", size: 14) ?? NSFont.monospacedSystemFont(ofSize: 14, weight: .regular) }
|
|
|
|
/// Editing-surface leading (blank source lines are the separator there).
|
|
static let lineHeightMultiple: CGFloat = 1.5
|
|
|
|
static var italicBodyFont: NSFont {
|
|
NSFontManager.shared.convert(bodyFont, toHaveTrait: .italicFontMask)
|
|
}
|
|
|
|
static var boldBodyFont: NSFont {
|
|
NSFontManager.shared.convert(bodyFont, toHaveTrait: .boldFontMask)
|
|
}
|
|
|
|
// MARK: Attribute stacks (editing surface)
|
|
|
|
static var foregroundColor: NSColor {
|
|
NSColor(red: 0.10, green: 0.10, blue: 0.09, alpha: 1)
|
|
}
|
|
|
|
/// Dimmed syntax color (the editing surface's 0.5 dim, #19).
|
|
static var syntaxColor: NSColor {
|
|
NSColor(white: 0.55, alpha: 1)
|
|
}
|
|
|
|
static var quoteRuleColor: NSColor {
|
|
NSColor(white: 0.78, alpha: 1)
|
|
}
|
|
|
|
/// Table borders + editing-surface hairline (≈ DesignTokens.border).
|
|
static var tableBorderColor: NSColor {
|
|
NSColor(red: 0xE8 / 255, green: 0xE5 / 255, blue: 0xDF / 255, alpha: 1)
|
|
}
|
|
|
|
static var bodyAttributes: [NSAttributedString.Key: Any] {
|
|
[
|
|
.font: bodyFont,
|
|
.paragraphStyle: ProsePresenter.paragraph(.body),
|
|
.foregroundColor: foregroundColor,
|
|
]
|
|
}
|
|
|
|
static var codeAttributes: [NSAttributedString.Key: Any] {
|
|
[
|
|
.font: codeFont,
|
|
.foregroundColor: syntaxColor,
|
|
]
|
|
}
|
|
}
|