`fontVariant` does not work with certain fonts
See original GitHub issueš Bug Report
The fontVariant
style prop doesnāt seem to work with most fonts. At first I thought this was only on custom fonts, but even commonly used āpre-packagedā fonts (Arial, Helvetica, Courier, etc.) cause the fontVariant
prop to have no effect.
To Reproduce
Use the fontVariant
style prop in conjunction with a font other than the system font. See Code Example below.
Expected Behavior
Expected the fontVariant props to have the same effect on style when used with other fonts. For example, when using fontFamily: 'Times', fontVariant: ['small-caps']
the lower-case letters SHOULD change to be smaller versions of the upper-case letter. However, this only occurs when using the System font.
Code Example
https://snack.expo.io/@charliecruzan/fontvarianttest
The above Snack shows the issue just in regards to fontVariant: ['small-caps']
, but you can also use the React-Native Tester testExample in a react-native app and just change the fontFamily to see the issue happen with all FontVariant options.
Environment
React Native Environment Info: System: OS: macOS 10.14.3 CPU: (12) x64 IntelĀ® Coreā¢ i7-8750H CPU @ 2.20GHz Memory: 313.39 MB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 11.6.0 - ~/.nvm/versions/node/v11.6.0/bin/node npm: 6.9.0 - ~/.nvm/versions/node/v11.6.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 IDEs: Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.1 => 0.59.1 npmGlobalPackages: react-native-cli: 2.0.1
Thanks, and let me know if thereās anything else I can provide to help out!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top GitHub Comments
yup this is the best approach, actually I believe it may have something to do with the Font itself and not strictly RN.
Iāll close this for now, please let me know if you can manage to prove that itās actually a RN issue (maybe test with another font that on a native iOS app works the expected way and not in RN?).
Yeah just tried getting this working in a Swift appā¦doesnāt seem to work. Although itās definitely possible Iām doing something wrong. Code is in this repo, you can run it in Xcode and see that Systemfont correctly uses small caps, but Hoefler Text doesnāt.