Skip to content

Add support for case-sensitive OpenType feature#56766

Open
ashfurrow wants to merge 1 commit into
facebook:mainfrom
ashfurrow:opentype-case-sensitive-forms
Open

Add support for case-sensitive OpenType feature#56766
ashfurrow wants to merge 1 commit into
facebook:mainfrom
ashfurrow:opentype-case-sensitive-forms

Conversation

@ashfurrow
Copy link
Copy Markdown

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 CSS font-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 case feature 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:

Screenshot 2026-05-06 at 9 49 58 PM

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.

kefa_side_by_side2

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-tester Text demos.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 11, 2026
@github-actions
Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@ashfurrow ashfurrow force-pushed the opentype-case-sensitive-forms branch from f8354c1 to 86609d5 Compare May 11, 2026 14:14
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label May 11, 2026
@sidferreira
Copy link
Copy Markdown

@ashfurrow thanks... now I can't unsee it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants