forked from organicmaps/organicmaps
[iOS] fix font in HTML descriptions
This commit is contained in:
parent
41b3c4d4ea
commit
60c5b1f471
1 changed files with 5 additions and 5 deletions
|
@ -50,18 +50,18 @@ extension NSMutableAttributedString {
|
|||
enumerateFont(baseFont)
|
||||
|
||||
guard estimatedWidth > 0 else { return }
|
||||
|
||||
|
||||
enumerateAttachments(estimatedWidth: estimatedWidth)
|
||||
}
|
||||
|
||||
func enumerateFont(_ font: UIFont) {
|
||||
func enumerateFont(_ baseFont: UIFont) {
|
||||
enumerateAttribute(.font, in: NSMakeRange(0, length), options: []) { (value, range, _) in
|
||||
if let font = value as? UIFont,
|
||||
let descriptor = font.fontDescriptor.withSymbolicTraits(font.fontDescriptor.symbolicTraits) {
|
||||
let newFont = UIFont(descriptor: descriptor, size: font.pointSize)
|
||||
let descriptor = baseFont.fontDescriptor.withSymbolicTraits(font.fontDescriptor.symbolicTraits) {
|
||||
let newFont = UIFont(descriptor: descriptor, size: baseFont.pointSize)
|
||||
addAttribute(.font, value: newFont, range: range)
|
||||
} else {
|
||||
addAttribute(.font, value: font, range: range)
|
||||
addAttribute(.font, value: baseFont, range: range)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue