feat(editor): 66ch measure + heading spacing (#77 follow-up)

- editor text centers at reading.css --measure 66ch (zero-advance × 66
  + 2×24pt padding), scroll view still fills the column
- headings get paragraphSpacingBefore 75 / after 30 (CSS 90/30 minus
  the visible blank separator's ~15pt)
This commit is contained in:
AlexKucera committed 2026-10-08 13:51:07 +02:00
1 parent 3934b10ec5
commit 46441438a2
3 files changed
+21 -2

No files matched your search

+9
View File
@@ -66,6 +66,15 @@ nonisolated enum ProseTypography {
NSFontManager.shared.convert(bodyFont, toSize: blankSize)
}
/// Editor measure (#77): reading.css `--measure: 66ch` — the advance of
/// "0" × 66 in the body face (px→pt 1:1), + the text container's 24pt
/// lineFragmentPadding on both sides (the CSS body's 24px side padding).
static var measureWidth: CGFloat {
let zero = NSAttributedString(string: "0", attributes: [.font: bodyFont])
let ch = zero.size().width
return (ch * 66).rounded() + 48
}
/// Line-height parity with reading.css (#77): CSS `line-height: n` means
/// n × font-size pixels; TextKit's lineHeightMultiple multiplies the
/// font's natural box (ascender − descender + leading ≈ 1.2 × size).