question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

`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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kelsetcommented, Mar 21, 2019

One thing we should try first is if we can get this working just in a vanilla ObjC/Swift app to see if itā€™s RN or just an iOS quirk.

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?).

0reactions
cruzachcommented, Mar 20, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

font-variant - CSS: Cascading Style Sheets - MDN Web Docs
The font-variant CSS shorthand property allows you to set all the font variants for a font.
Read more >
font-variant - CSS-Tricks
The font-variant property allows you to change the targeted text to small caps. This property has been extended in CSS3.
Read more >
Why is my small-caps font-variant CSS class being disregarded?
Small-caps means that lowercase letters are turned into slightly smaller variations of uppercase letters. Uppercase letters stay unchanged.
Read more >
CSS font-variant property - W3Schools
In a small-caps font, all lowercase letters are converted to uppercase letters. ... The font-variant property specifies whether or not a text should...
Read more >
How font-variant property work in CSS with Examples - eduCBA
Here we discuss an introduction to CSS font-variant, syntax, how does it work, ... property specifies whether a text should be set to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found