Skip to content

Commit

Permalink
fix(ios): fix the "given a font name rather than font family" condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyunong committed Oct 22, 2024
1 parent 46d3540 commit b8c1816
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions renderer/native/ios/renderer/HippyFont.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b8c1816

Please sign in to comment.