Use Atkinson Hyperlegible Next, keeping Mono for code

This commit is contained in:
Ian Gulliver
2026-10-21 08:48:30 -07:00
parent 279919c6cd
commit 6a949dc448
14 changed files with 28 additions and 118 deletions
+6 -4
View File
@@ -172,6 +172,7 @@ struct InlineRenderer {
var color: Color?
var small = false
var tip: String?
var mono = false
}
func segments(_ items: [MDInline]) -> [MDSegment] {
@@ -192,8 +193,8 @@ struct InlineRenderer {
private func run(_ s: String, _ style: Style) -> AttributedString {
var a = AttributedString(s)
a.font = Fonts.font(style.small ? 11 : size, weight: style.bold ? 700 : weight, italic: style.italic)
a.mergeAttributes(try! AttributeContainer([.font: Fonts.ns(style.small ? 11 : size, weight: style.bold ? 700 : weight, italic: style.italic)], including: \.appKit))
a.font = Fonts.font(style.small ? 11 : size, weight: style.bold ? 700 : weight, italic: style.italic, mono: style.mono)
a.mergeAttributes(try! AttributeContainer([.font: Fonts.ns(style.small ? 11 : size, weight: style.bold ? 700 : weight, italic: style.italic, mono: style.mono)], including: \.appKit))
if let link = style.link {
a.link = link
}
@@ -224,6 +225,7 @@ struct InlineRenderer {
append(run("\n", style), &out)
case .code(let c):
var s = style
s.mono = true
if s.link == nil, let path = codeFile(c) {
s.link = path
s.color = Palette.accent
@@ -795,7 +797,7 @@ private struct BlockView: View {
Copyable(text: code) {
ScrollView(.horizontal) {
Text(verbatim: code)
.font(Fonts.font(ctx.size))
.font(Fonts.font(ctx.size, mono: true))
.foregroundStyle(Palette.text)
.textSelection(.enabled)
.fixedSize()
@@ -881,7 +883,7 @@ private struct DiffBlock: View {
StretchColumn(minWidth: width) {
ForEach(Array(lines.enumerated()), id: \.offset) { _, line in
Text(verbatim: line.isEmpty ? " " : line)
.font(Fonts.font(size))
.font(Fonts.font(size, mono: true))
.foregroundStyle(line.hasPrefix("@@") || line.hasPrefix("+++") || line.hasPrefix("---") ? Palette.muted : Palette.text)
.textSelection(.enabled)
.fixedSize()