Add support for case-sensitive OpenType feature#56766
Open
ashfurrow wants to merge 1 commit into
Open
Conversation
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
f8354c1 to
86609d5
Compare
|
@ashfurrow thanks... now I can't unsee it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This adds support for React Native to render text with the "case-sensitive forms" OpenType feature enabled. Similar to ligatures and tabular numbers, case sensitive forms modify how the font is rendered.
Normally, fonts vertically align their punctuation (eg
+or-) with lowercase letters. Most letters are lower-case, so that makes sense. But for apps that use upper-case letters or numbers, the punctuation looks too low. Case-sensitive forms align these marks with uppercase letters and numbers, analogous to the CSSfont-feature-settings: 'case'property. This is already supported by iOS and Android text rendering, I just exposed the functionality to the JS side.I work on an app that displays financial data, with lots of numbers and stock symbols, and our punctuation looked too low. We are already using this patch in production, but I'd like to see it become part of React Native itself.
Changelog:
[GENERAL] [ADDED] - Add support for case-sensitive OpenType feature
Test Plan:
I added unit test coverage where I could and made sure everything compiled on both platforms.
I added a Demo for this to the iOS and Android Text demos, in
rn-tester. There were some setbacks.On iOS, I found a pre-installed font that supports the
casefeature but learned that the iOS simulator doesn't render the difference for this font. I installed on a device and it worked. I left the demo with a note. See the difference here, on the-character:On Android, things were trickier because the in-built fonts on my device didn't support the OpenType feature. I installed the same font I used on iOS onto my Android device and got it working.
Since I couldn't get the demo to show the difference using the stock fonts on my device, I left the demo out of the Android
rn-testerText demos.