From 60c5b1f471baf4bf23280b7f0df444a065b4c60c Mon Sep 17 00:00:00 2001 From: Aleksey Belouosv Date: Tue, 24 Sep 2019 17:22:55 +0300 Subject: [PATCH] [iOS] fix font in HTML descriptions --- iphone/Maps/Categories/NSAttributedString+HTML.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iphone/Maps/Categories/NSAttributedString+HTML.swift b/iphone/Maps/Categories/NSAttributedString+HTML.swift index a629f7a3d5..0a6c9d9c83 100644 --- a/iphone/Maps/Categories/NSAttributedString+HTML.swift +++ b/iphone/Maps/Categories/NSAttributedString+HTML.swift @@ -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) } } }