-
Notifications
You must be signed in to change notification settings - Fork 149
Add apple_fontSmoothing style and global default setting #329
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
Conversation
…iew." This reverts commit 5a67ae0.
|
Wow, I didn't actually expect a new style attribute to be added to Text for this, I only expected the way to set the default statically. If you'd like to add the style attribute to view, how do you feel about prefixing it as |
Or apple_fontSmoothing since it works on mac or ios ? |
__block UIBezierPath *highlightPath = nil; | ||
NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange | ||
actualGlyphRange:NULL]; | ||
// [TODO(OSS Candidate ISS#2710739) |
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.
I think that the feature is awesome.
It feels that this property should be part of like ParagraphAttributes
(see Fabric's ParagraphAttributes
), not TextAttributes
.
So, it should be applied to the whole text node. Or, do we have use cases where it should be applied only for some fragments?
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.
Well, the biggest reason we can't do that is because mac doesn't work with Fabric yet so we have no ParagraphAttributes 😢. Otherwise, just to be parallel with the w3c font-smooth
style and webkit --webkit-font-smoothing
styles which can be applied at any level of granularity.
I think I'm fine with |
Done! |
Not that my approval means anything here, but LGTM. 😉 I think Valentin's comments are probably non-blocking here and could get figured out and addressed when this gets upstreamed. |
| 'proportional-nums', | ||
>, | ||
>), | ||
/** [TODO(OSS Candidate ISS#2710739) |
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.
Where is this deprecated file still used?
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.
I actually don't know. But it contains all the same props as the other files like ViewConfig so I made it parallel.
} | ||
|
||
// [TODO(macOS ISS#2323203) | ||
if (_fontSmoothing != RCTFontSmoothingAuto) { |
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.
Is it possible it could get set to something other than auto and then set back to auto (which would then fail to update here)?
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.
Hmm, that's a good point. Although in practice I doubt anyone is going to be toggling this style on and off. I'll test some stuff out setting it without the condition
…rosoft#329)" This reverts commit a4287a0.
Please select one of the following
Webkit and Chromium have a
-webkit-font-smoothing
style to control antialiasing of fonts. https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth. A web page can choose subpixel antialiasing (the default) or regular antialiasing. Web pages and/or Electron apps on mac may elect to use regular antialiasing. To allow hybrid apps that may be react-native views embedding a web view, or an Electron app embedding a react-native view, react-native needs a similar style.This change adds an
apple_fontSmoothing
text style that is identical to-webkit-font-smoothing
. The default valueauto
will use the default setting which is the same assubpixel-antialiased
. The native app may change the default ofauto
by calling[RCTTextAttributes setFontSmoothingDefault:RCTFontSmoothingAntialiased];
Focus areas to test
A simple test case was added to the
<Text>
RNTester page. TheAppDelegate.m
of both the mac and ios RNTester apps have an example usage of[RCTTextAttributes setFontSmoothingDefault:RCTFontSmoothingSubpixelAntialiased]
Microsoft Reviewers: Open in CodeFlow