mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-27 09:21:21 +01:00
Swap baseDescriptor and currentDescriptor to allow semibold to come through
This commit is contained in:
parent
37f1ebc025
commit
688b24f18e
@ -46,18 +46,16 @@ extension NSAttributedString {
|
|||||||
guard let font = font as? Font else { return }
|
guard let font = font as? Font else { return }
|
||||||
|
|
||||||
let currentDescriptor = font.fontDescriptor
|
let currentDescriptor = font.fontDescriptor
|
||||||
let symbolicTraits = font.fontDescriptor.symbolicTraits
|
let symbolicTraits = baseSymbolicTraits.union(currentDescriptor.symbolicTraits)
|
||||||
let newSymbolicTraits = baseSymbolicTraits.union(symbolicTraits)
|
|
||||||
|
|
||||||
var descriptor = baseDescriptor.addingAttributes(currentDescriptor.fontAttributes)
|
var descriptor = currentDescriptor.addingAttributes(baseDescriptor.fontAttributes)
|
||||||
|
|
||||||
#if canImport(AppKit)
|
#if canImport(AppKit)
|
||||||
descriptor = descriptor.withSymbolicTraits(newSymbolicTraits)
|
descriptor = descriptor.withSymbolicTraits(symbolicTraits)
|
||||||
#else
|
#else
|
||||||
descriptor = descriptor.withSymbolicTraits(newSymbolicTraits)!
|
descriptor = descriptor.withSymbolicTraits(symbolicTraits)!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
let newFont = Font(descriptor: descriptor, size: size)
|
let newFont = Font(descriptor: descriptor, size: size)
|
||||||
|
|
||||||
mutable.addAttribute(.font, value: newFont as Any, range: range)
|
mutable.addAttribute(.font, value: newFont as Any, range: range)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user