feat: typography controls — lineHeight, fontThicken - #62
Merged
Conversation
griffinwork40
force-pushed
the
afk/typography-controls
branch
from
August 25, 2026 20:11
278841b to
87e1fb4
Compare
Config fields: - fontThicken: bool — applies CGContextSetFontSmoothingStyle(48) before SwiftTerm glyph draw, the same medium dilation Terminal.app uses. Confined to UmberTerminalView.draw(_:) so the context is always the right one for the in-flight draw call. - lineHeight: CGFloat 0.8–2.0 — multiplier on font natural metrics, wired to SwiftTerm's public lineSpacing property which correctly resizes the terminal grid after changing (no partial relayout). Extraction: font-sizing methods moved from TerminalPane.swift (was 346/350 LOC) into new TerminalPane+Typography.swift. Access fix: config and fontSize were private (file-scoped); changed to internal so the cross-file extension can read/write them. The comment explains why (Swift private = file-scoped, not class-scoped). applyTypography(_:) is called from apply(config:) AFTER setFontSize because lineSpacing internally calls resetFont() → computeFontDimensions() → processSizeChange, all of which require the font to be installed first. Vendor draw(_:) status: MacTerminalView.swift:954 declares 'open override func draw(_ dirtyRect:)' — the override in UmberTerminalView is valid and the build confirms it. No vendor patch needed. StarterConfig.swift: added fontThicken and lineHeight commented entries with usage docs matching the config fields. All files ≤ 350 LOC (TerminalPane.swift: 317).
griffinwork40
force-pushed
the
afk/typography-controls
branch
from
August 25, 2026 20:14
87e1fb4 to
6e7f229
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Typography controls: lineHeight + fontThicken
Adds two user-configurable typography fields and extracts the font-sizing
methods into a dedicated extension file.
What ships
fontThicken(bool, default false)Applies
CGContextSetFontSmoothingStyle(48)— medium sub-pixel dilation —before SwiftTerm's glyph draw pass. This is the same style Terminal.app uses
(and iTerm2, MacVim, Emacs). It compensates for the AA bleed direction on
white-on-dark rendering that makes terminal text appear thinner than the same
font on a light background.
UmberTerminalView.draw(_:)so the CGContext isalways the one live for the current draw call.
pass-through to
super.draw(dirtyRect).missing-symbol error at build time if Apple removes it (no silent runtime trap).
MacTerminalView.swift:954already declaresopen override func draw,so no vendor patch is needed.
lineHeight(CGFloat 0.8–2.0, default 1.0)Multiplier on the font's natural line metrics, wired to SwiftTerm's public
lineSpacingproperty.1.2= 20% extra leading. The setter internallycalls
resetFont()→computeFontDimensions()→processSizeChange, whichcorrectly resizes the terminal grid — no partial relayout or clipped rows.
applyTypography(_:)is called fromapply(config:)aftersetFontSizebecause
lineSpacingneeds the font already installed on the view.Extraction: TerminalPane+Typography.swift (new file)
TerminalPane.swiftwas at 346/350 LOC. The font-sizing block (constants,setFontSize,adjustFontSize,resetFontSize,currentFontSize) moved toTerminalPane+Typography.swiftalongside the newapplyTypography(_:).Access fix:
configandfontSizewereprivate(file-scoped in Swift).Changed to
internal(default, no keyword) so the cross-file extension canreach them. A comment in the source explains why — Swift
privateisfile-scoped, not class-scoped, unlike many other languages.
What does NOT ship (deferred)
attributes,urlAttributes)is a
private varonTerminalViewwith no public setter. Disabling ligatureswould require a vendored patch to
getAttributes(_:withUrl:). Omitted ratherthan half-implemented; documented in
TerminalPane+Typography.swiftheader.File sizes
All files ≤ 350 LOC.
TerminalPane.swiftwent from 346 → 317 lines.Checklist
swift buildpasses (zero errors, pre-existing warnings only)bash Scripts/check-file-size.sh— all 117 files within ceilingfontThickenandlineHeightdocumented inStarterConfig.swiftwith usage notes@MainActor, notry!draw(_:)is alreadyopen— no patch required