From df6a82a35b256b764fd0b6296fee3055048c0006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=CC=81s=CC=8C=20Gergel?= Date: Fri, 5 Jul 2024 23:23:44 +0200 Subject: [PATCH] Minor font related fixes 1) Fixes problems with custom fonts not loading correctly according to "familyName". To specify a font it is necessary to use its "fontName" 2) Minor behaviour modification when adding the "bold" attribute so that the text behaves similarly like when the system font is used --- Sources/ZMarkupParser/Core/MarkupStyle/MarkupStyleFont.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ZMarkupParser/Core/MarkupStyle/MarkupStyleFont.swift b/Sources/ZMarkupParser/Core/MarkupStyle/MarkupStyleFont.swift index bb506d1..301a8b2 100644 --- a/Sources/ZMarkupParser/Core/MarkupStyle/MarkupStyleFont.swift +++ b/Sources/ZMarkupParser/Core/MarkupStyle/MarkupStyleFont.swift @@ -142,7 +142,7 @@ extension MarkupStyleFont { if let fontWeight = FontWeightStyle.init(font: font) { self.weight = FontWeight.style(fontWeight) } - self.familyName = .familyNames([font.familyName]) + self.familyName = .familyNames([font.fontName, font.familyName]) } func getFont() -> UIFont? { @@ -164,7 +164,7 @@ extension MarkupStyleFont { font = UIFont.systemFont(ofSize: size, weight: weight) } - if weight.rawValue >= UIFont.Weight.medium.rawValue { + if weight.rawValue >= UIFont.Weight.semibold.rawValue { traits.append(.traitBold) }