add headline ascender offset for better look
This commit is contained in:
parent
0e3c08f341
commit
ddcb8bb93c
@ -73,8 +73,11 @@ import Foundation
|
||||
// When messing with the maximum line height, the baseline needs to be adjusted.
|
||||
let baseLineOffset = planLabel.font.descender + (overshoot / 2.0)
|
||||
|
||||
// We want the top to align with the top of the headline capitals, ignoring ascenders.
|
||||
let headlineMatchingOffset = headline.font.ascender - headline.font.capHeight
|
||||
|
||||
let paragraphStyle = NSMutableParagraphStyle()
|
||||
paragraphStyle.maximumLineHeight = planLabel.font.capHeight + overshoot
|
||||
paragraphStyle.maximumLineHeight = planLabel.font.capHeight + overshoot + headlineMatchingOffset
|
||||
attributedString.addAttribute(.paragraphStyle, value: paragraphStyle, range: range)
|
||||
attributedString.addAttribute(.baselineOffset, value: baseLineOffset, range: range)
|
||||
planLabel.attributedText = attributedString
|
||||
|
||||
Loading…
Reference in New Issue
Block a user