-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
feat(android): font variation settings #44667
base: main
Are you sure you want to change the base?
feat(android): font variation settings #44667
Conversation
|
Base commit: 4c6bff0 |
Not sure why the bot still says the changelog is missing :) |
...ve/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.kt
Outdated
Show resolved
Hide resolved
...eact-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
Outdated
Show resolved
Hide resolved
4f6d057
to
e63e994
Compare
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.
This seems pretty sane to me, though we need to update the logic around Span management in ReactEditText a bit, for the new fields added to CustomStyleSpan.
Could we make sure to validate against Paper and Fabric, for both Text and TextInput?
...ve/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.kt
Outdated
Show resolved
Hide resolved
...eact-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
Outdated
Show resolved
Hide resolved
...eact-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java
Outdated
Show resolved
Hide resolved
e63e994
to
9dd41dd
Compare
...eact-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
Outdated
Show resolved
Hide resolved
...ve/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.kt
Outdated
Show resolved
Hide resolved
8549425
to
afba1de
Compare
I updated some stuff regarding the edit text for paper but unfortunetaly it's not working. What am I missing here? @NickGerleman |
Hard to tell without debugging. Does prop setter for ShadowNode get hit? |
I debugged it last week using a debugger, and it was being hit. I will do some more testing. |
afba1de
to
424323b
Compare
Summary
Continuation of the old PR: #36371
This PR adds font variation settings feature for variable fonts in react native. The
fontVariationSettings
property provides low-level control over variable font characteristics, by specifying the four letter axis names of the characteristics you want to vary, along with their values.Registered axes are the most commonly encountered — common enough that the authors of the specification felt they were worth standardizing. Note that this doesn't mean that the author has to include all of these in their font.
Custom axes can be anything the font designer wants to vary in their font, for example ascender or descender heights, the size of serifs, or anything else they can imagine. Any axis can be used as long as it is given a unique 4-character axis. Some will end up becoming more common, and may even become registered over time.
Example
Font characteristics set using
fontVariationSettings
will always override those set using the corresponding basic font properties, e.g.fontWeight
regardless of the order.References
Android Documentation
iOS Documentation
MDN Documentation
Specification
Screenshots
This is a part of the other work for iOS that is being done by @davebcn87.
Changelog
[ANDROID] [ADDED] - Add fontVariationSettings support for variable font in Android
Test Plan