From b8c1816a6f7d8649fae0363b8a84dfb8b59e1ce6 Mon Sep 17 00:00:00 2001 From: arnonchen <745735906@qq.com> Date: Tue, 22 Oct 2024 20:36:03 +0800 Subject: [PATCH] fix(ios): fix the "given a font name rather than font family" condition --- renderer/native/ios/renderer/HippyFont.mm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/renderer/native/ios/renderer/HippyFont.mm b/renderer/native/ios/renderer/HippyFont.mm index 4b037678a40..b5880732bcc 100644 --- a/renderer/native/ios/renderer/HippyFont.mm +++ b/renderer/native/ios/renderer/HippyFont.mm @@ -284,11 +284,16 @@ + (UIFont *)updateFont:(UIFont *)font // Gracefully handle being given a font name rather than font family, for // example: "Helvetica Light Oblique" rather than just "Helvetica". if (!didFindFont && familyName.length > 0 && fontNamesForFamilyName(familyName).count == 0) { - familyName = [HippyFont familyNameWithCSSNameMatching:familyName] ?: familyName; - fontWeight = weight ? fontWeight : weightOfFont(font); - isItalic = style ? isItalic : isItalicFont(font); - isCondensed = isCondensedFont(font); - font = cachedSystemFont(fontSize, fontWeight); + font = [UIFont fontWithName:familyName size:fontSize]; + if (font) { + didFindFont = YES; + } + else { + fontWeight = weight ? fontWeight : weightOfFont(font); + isItalic = style ? isItalic : isItalicFont(font); + isCondensed = isCondensedFont(font); + font = cachedSystemFont(fontSize, fontWeight); + } if (font) { // It's actually a font name, not a font family name,