mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
Fabric: Fixes custom font of weight is not honored (#47691)
Summary: Fixes https://github.com/facebook/react-native/issues/47656 . ## Changelog: [IOS] [FIXED] - Fabric: Fixes custom font of weight is not honored Pull Request resolved: https://github.com/facebook/react-native/pull/47691 Test Plan: Demo in https://github.com/facebook/react-native/issues/47656 Reviewed By: cipolleschi Differential Revision: D66174732 Pulled By: javache fbshipit-source-id: 5e6a8c870d3a13283548c736aed73193f7976bfc
This commit is contained in:
parent
156454ef39
commit
933356e2a6
@ -170,12 +170,15 @@ UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties)
|
||||
// Gracefully handle being given a font name rather than font family, for
|
||||
// example: "Helvetica Light Oblique" rather than just "Helvetica".
|
||||
font = [UIFont fontWithName:fontProperties.family size:effectiveFontSize];
|
||||
|
||||
if (!font) {
|
||||
if (font) {
|
||||
fontNames = [UIFont fontNamesForFamilyName:font.familyName];
|
||||
} else {
|
||||
// Failback to system font.
|
||||
font = [UIFont systemFontOfSize:effectiveFontSize weight:fontProperties.weight];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if (fontNames.count > 0) {
|
||||
// Get the closest font that matches the given weight for the fontFamily
|
||||
CGFloat closestWeight = INFINITY;
|
||||
for (NSString *name in fontNames) {
|
||||
|
Loading…
Reference in New Issue
Block a user