-
Notifications
You must be signed in to change notification settings - Fork 24.8k
(iOS) Support for DemiBold alias of SemiBold (font-weight 600) #15856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For more information see [this post](https://www.quora.com/What-is-the-difference-between-Medium-Demi-and-Semibold-fonts). DemiBold is fairly common in font naming, and React Native lacks support of "AvNext-DemiBold" for example.
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
2 similar comments
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
From what I can tell, these are valid aliases. Have you looked into the Android side as well? |
@ide - from what I have read, using numeric font weights ('500', '600', '700'...etc) don't work in android. Is this not the case? In Android, I currently just explicitly specify |
7ba4d71
to
a0a64d0
Compare
@ide - here's a post that outlines the discrepancy between iOS and android when it comes to font weights. Because there is no font-weight-matching logic on android from a numeric value to a font name, this problem doesn't (yet) apply. On Android you have to be discrete about each font name, which means demibold will already work (it does for me testing both). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
React/Views/RCTFont.mm
Outdated
@(UIFontWeightBold), | ||
@(UIFontWeightHeavy), | ||
@(UIFontWeightBlack) | ||
]; | ||
}); | ||
|
||
for (NSInteger i = 0; i < fontNames.count; i++) { | ||
for (NSUInteger i = 0; i < fontNames.count; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modern Apple convention is "always use NSInteger
unless you really need to use NSUInteger
", we are following it in RN.
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: For more information on font weight naming see [this post](https://www.quora.com/What-is-the-difference-between-Medium-Demi-and-Semibold-fonts). DemiBold is fairly common in font naming. For example, iOS React Native lacks support of "AvNext-DemiBold". Also removed warning about `NSUInteger` <=> `NSInteger` comparison, by making `i` an `NSUInteger` Before and after screenshots:   Add any DemiBold font to an iOS react native project. Set fontWeight to `'600'` on a `<Text />` component. The font weight should be applied appropriately. Closes facebook#15856 Differential Revision: D5800928 Pulled By: shergin fbshipit-source-id: 9095e3e150847f9cb828aa5d080567846441e55d
Summary: For more information on font weight naming see [this post](https://www.quora.com/What-is-the-difference-between-Medium-Demi-and-Semibold-fonts). DemiBold is fairly common in font naming. For example, iOS React Native lacks support of "AvNext-DemiBold". Also removed warning about `NSUInteger` <=> `NSInteger` comparison, by making `i` an `NSUInteger` Before and after screenshots:   Add any DemiBold font to an iOS react native project. Set fontWeight to `'600'` on a `<Text />` component. The font weight should be applied appropriately. Closes facebook#15856 Differential Revision: D5800928 Pulled By: shergin fbshipit-source-id: 9095e3e150847f9cb828aa5d080567846441e55d
For more information on font weight naming see this post.
DemiBold is fairly common in font naming. For example, iOS React Native lacks support of "AvNext-DemiBold".
Also removed warning about
NSUInteger
<=>NSInteger
comparison, by makingi
anNSUInteger
Before and after screenshots:
Before fix
After
Test Plan
Add any DemiBold font to an iOS react native project. Set fontWeight to
'600'
on a<Text />
component. The font weight should be applied appropriately.