diff --git a/Mac/MainWindow/Timeline/Cell/NSAttributedString+NetNewsWire.swift b/Mac/MainWindow/Timeline/Cell/NSAttributedString+NetNewsWire.swift index 2fdc1f18e..6c57c2e83 100644 --- a/Mac/MainWindow/Timeline/Cell/NSAttributedString+NetNewsWire.swift +++ b/Mac/MainWindow/Timeline/Cell/NSAttributedString+NetNewsWire.swift @@ -20,7 +20,7 @@ extension NSAttributedString { let size = baseFont.pointSize let baseDescriptor = baseFont.fontDescriptor - let symbolicTraits = baseDescriptor.symbolicTraits + let baseSymbolicTraits = baseDescriptor.symbolicTraits let baseTraits = baseDescriptor.object(forKey: .traits) as! [NSFontDescriptor.TraitKey: Any] let baseWeight = baseTraits[.weight] as! NSFont.Weight @@ -28,15 +28,21 @@ extension NSAttributedString { mutable.enumerateAttribute(.font, in: fullRange, options: []) { (font: Any?, range: NSRange, stop: UnsafeMutablePointer) in guard let font = font as? NSFont else { return } - var newSymbolicTraits = symbolicTraits + var newSymbolicTraits = baseSymbolicTraits - if font.fontDescriptor.symbolicTraits.contains(.italic) { + let symbolicTraits = font.fontDescriptor.symbolicTraits + + if symbolicTraits.contains(.italic) { newSymbolicTraits.insert(.italic) } + if symbolicTraits.contains(.monoSpace) { + newSymbolicTraits.insert(.monoSpace) + } + var descriptor = baseDescriptor.withSymbolicTraits(newSymbolicTraits) - if font.fontDescriptor.symbolicTraits.contains(.bold) { + if symbolicTraits.contains(.bold) { // If the base font is semibold (as timeline titles are), make the "bold" // text heavy for better contrast.