diff --git a/.gitattributes b/.gitattributes index 8f9372e008985a..e41d05ed521342 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,4 @@ # that. gradlew text eol=lf *.sh text eol=lf +*.command text eol=lf diff --git a/Libraries/Components/View/ReactNativeViewViewConfig.js b/Libraries/Components/View/ReactNativeViewViewConfig.js index a4cf78746409c0..440be0e906c40c 100644 --- a/Libraries/Components/View/ReactNativeViewViewConfig.js +++ b/Libraries/Components/View/ReactNativeViewViewConfig.js @@ -270,6 +270,7 @@ const ReactNativeViewConfig = { fontStyle: true, fontVariant: true, fontWeight: true, + apple_fontSmoothing: true, // TODO(OSS Candidate ISS#2710739) height: true, includeFontPadding: true, justifyContent: true, diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js index 63ab3213ffd6e7..91f84f52b11d4b 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js @@ -74,6 +74,17 @@ const DeprecatedTextStylePropTypes = { | 'proportional-nums', >, >), + /** [TODO(OSS Candidate ISS#2710739) + * @platform ios, macos + */ + apple_fontSmoothing: (ReactPropTypes.oneOf([ + 'auto' /*default*/, + 'none', + 'antialiased', + 'subpixel-antialiased', + ]): React$PropType$Primitive< + 'auto' | 'none' | 'antialiased' | 'subpixel-antialiased', + >), // ]TODO(OSS Candidate ISS#2710739) textShadowOffset: (ReactPropTypes.shape({ width: ReactPropTypes.number, height: ReactPropTypes.number, diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index abb0c769be62b6..9d93b36dd1c940 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -602,6 +602,11 @@ export type ____TextStyle_Internal = $ReadOnly<{| | 'tabular-nums' | 'proportional-nums', >, + apple_fontSmoothing?: + | 'auto' + | 'none' + | 'antialiased' + | 'subpixel-antialiased', // TODO(OSS Candidate ISS#2710739) textShadowOffset?: $ReadOnly<{| width: number, height: number, diff --git a/Libraries/Text/BaseText/RCTBaseTextViewManager.m b/Libraries/Text/BaseText/RCTBaseTextViewManager.m index 2899a7f180a249..e032f586b7e1c0 100644 --- a/Libraries/Text/BaseText/RCTBaseTextViewManager.m +++ b/Libraries/Text/BaseText/RCTBaseTextViewManager.m @@ -38,6 +38,7 @@ - (RCTShadowView *)shadowView RCT_REMAP_SHADOW_PROPERTY(allowFontScaling, textAttributes.allowFontScaling, BOOL) RCT_REMAP_SHADOW_PROPERTY(maxFontSizeMultiplier, textAttributes.maxFontSizeMultiplier, CGFloat) RCT_REMAP_SHADOW_PROPERTY(letterSpacing, textAttributes.letterSpacing, CGFloat) +RCT_REMAP_SHADOW_PROPERTY(apple_fontSmoothing, textAttributes.fontSmoothing, RCTFontSmoothing) // TODO(OSS Candidate ISS#2710739) // Paragraph Styles RCT_REMAP_SHADOW_PROPERTY(lineHeight, textAttributes.lineHeight, CGFloat) RCT_REMAP_SHADOW_PROPERTY(textAlign, textAttributes.alignment, NSTextAlignment) diff --git a/Libraries/Text/RCTTextAttributes.h b/Libraries/Text/RCTTextAttributes.h index 2c7d24ffa259b6..ea02c9e64dc014 100644 --- a/Libraries/Text/RCTTextAttributes.h +++ b/Libraries/Text/RCTTextAttributes.h @@ -8,12 +8,14 @@ #import // TODO(macOS ISS#2323203) #import +#import // TODO(OSS Candidate ISS#2710739) #import "RCTTextTransform.h" NS_ASSUME_NONNULL_BEGIN extern NSString *const RCTTextAttributesIsHighlightedAttributeName; +extern NSString *const RCTTextAttributesFontSmoothingAttributeName; // TODO(OSS Candidate ISS#2710739) extern NSString *const RCTTextAttributesTagAttributeName; /** @@ -37,6 +39,8 @@ extern NSString *const RCTTextAttributesTagAttributeName; @property (nonatomic, copy, nullable) NSArray *fontVariant; @property (nonatomic, assign) BOOL allowFontScaling; @property (nonatomic, assign) CGFloat letterSpacing; +@property (nonatomic, assign) RCTFontSmoothing fontSmoothing; // TODO(OSS Candidate ISS#2710739) +@property (class, nonatomic, assign) RCTFontSmoothing fontSmoothingDefault; // TODO(OSS Candidate ISS#2710739) // Paragraph Styles @property (nonatomic, assign) CGFloat lineHeight; @property (nonatomic, assign) NSTextAlignment alignment; diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index 9e9dce3b729acf..746ade425f0f7a 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -12,6 +12,7 @@ #import NSString *const RCTTextAttributesIsHighlightedAttributeName = @"RCTTextAttributesIsHighlightedAttributeName"; +NSString *const RCTTextAttributesFontSmoothingAttributeName = @"RCTTextAttributesFontSmoothingAttributeName"; // TODO(OSS Candidate ISS#2710739) NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttributeName"; @implementation RCTTextAttributes @@ -56,6 +57,7 @@ - (void)applyTextAttributes:(RCTTextAttributes *)textAttributes _fontVariant = textAttributes->_fontVariant ?: _fontVariant; _allowFontScaling = textAttributes->_allowFontScaling || _allowFontScaling; // * _letterSpacing = !isnan(textAttributes->_letterSpacing) ? textAttributes->_letterSpacing : _letterSpacing; + _fontSmoothing = textAttributes->_fontSmoothing != RCTFontSmoothingAuto ? textAttributes->_fontSmoothing : _fontSmoothing; // TODO(OSS Candidate ISS#2710739) // Paragraph Styles _lineHeight = !isnan(textAttributes->_lineHeight) ? textAttributes->_lineHeight : _lineHeight; @@ -183,6 +185,12 @@ - (NSParagraphStyle *)effectiveParagraphStyle attributes[RCTTextAttributesIsHighlightedAttributeName] = @YES; } + // [TODO(macOS ISS#2323203) + if (_fontSmoothing != RCTFontSmoothingAuto) { + attributes[RCTTextAttributesFontSmoothingAttributeName] = @(_fontSmoothing); + } + // ]TODO(macOS ISS#2323203) + if (_tag) { attributes[RCTTextAttributesTagAttributeName] = _tag; } @@ -290,6 +298,7 @@ - (BOOL)isEqual:(RCTTextAttributes *)textAttributes RCTTextAttributesCompareObjects(_fontVariant) && RCTTextAttributesCompareOthers(_allowFontScaling) && RCTTextAttributesCompareFloats(_letterSpacing) && + RCTTextAttributesCompareOthers(_fontSmoothing) && // TODO(OSS Candidate ISS#2710739) // Paragraph Styles RCTTextAttributesCompareFloats(_lineHeight) && RCTTextAttributesCompareFloats(_alignment) && @@ -309,4 +318,16 @@ - (BOOL)isEqual:(RCTTextAttributes *)textAttributes RCTTextAttributesCompareOthers(_textTransform); } +// [TODO(OSS Candidate ISS#2710739) +static RCTFontSmoothing _fontSmoothingDefault = RCTFontSmoothingAuto; + ++ (RCTFontSmoothing)fontSmoothingDefault { + return _fontSmoothingDefault; +} + ++ (void)setFontSmoothingDefault:(RCTFontSmoothing)fontSmoothingDefault { + _fontSmoothingDefault = fontSmoothingDefault; +} +// ]TODO(OSS Candidate ISS#2710739) + @end diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index 227a7b81b88cca..23e3601deec3fd 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -159,12 +159,40 @@ - (void)drawRect:(CGRect)rect NSTextContainer *textContainer = layoutManager.textContainers.firstObject; NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; - [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:_contentFrame.origin]; - [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:_contentFrame.origin]; - - __block UIBezierPath *highlightPath = nil; NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL]; + // [TODO(OSS Candidate ISS#2710739) + [_textStorage enumerateAttribute:RCTTextAttributesFontSmoothingAttributeName + inRange:characterRange + options:0 + usingBlock: + ^(NSNumber *value, NSRange range, __unused BOOL *stop) { + RCTFontSmoothing smoothing = value.integerValue; + if (smoothing == RCTFontSmoothingAuto) { + smoothing = [RCTTextAttributes fontSmoothingDefault]; + } + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSaveGState(context); + switch (smoothing) { + case RCTFontSmoothingNone: + CGContextSetShouldAntialias(context, false); + break; + case RCTFontSmoothingAntialiased: + CGContextSetAllowsFontSmoothing(context, false); + CGContextSetShouldSmoothFonts(context, false); + break; + case RCTFontSmoothingAuto: + case RCTFontSmoothingSubpixelAntialiased: + break; + } + NSRange subGlyphRange = [layoutManager glyphRangeForCharacterRange:range actualCharacterRange:nil]; + [layoutManager drawBackgroundForGlyphRange:subGlyphRange atPoint:_contentFrame.origin]; + [layoutManager drawGlyphsForGlyphRange:subGlyphRange atPoint:_contentFrame.origin]; + CGContextRestoreGState(context); + }]; + // ]TODO(OSS Candidate ISS#2710739) + + __block UIBezierPath *highlightPath = nil; [_textStorage enumerateAttribute:RCTTextAttributesIsHighlightedAttributeName inRange:characterRange options:0 diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 442e036662fbb5..2dfa401baca817 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -1,14 +1,14 @@ PODS: - boost-for-react-native (1.63.0) - DoubleConversion (1.1.6) - - FBLazyVector (0.61.5-microsoft-fb61merge.1) - - FBReactNativeSpec (0.61.5-microsoft-fb61merge.1): + - FBLazyVector (1000.0.0) + - FBReactNativeSpec (1000.0.0): - Folly (= 2018.10.22.00) - - RCTRequired (= 0.61.5-microsoft-fb61merge.1) - - RCTTypeSafety (= 0.61.5-microsoft-fb61merge.1) - - React-Core (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/turbomodule/core (= 0.61.5-microsoft-fb61merge.1) + - RCTRequired (= 1000.0.0) + - RCTTypeSafety (= 1000.0.0) + - React-Core (= 1000.0.0) + - React-jsi (= 1000.0.0) + - ReactCommon/turbomodule/core (= 1000.0.0) - Folly (2018.10.22.00): - boost-for-react-native - DoubleConversion @@ -19,235 +19,235 @@ PODS: - DoubleConversion - glog - glog (0.3.5) - - RCTRequired (0.61.5-microsoft-fb61merge.1) - - RCTTypeSafety (0.61.5-microsoft-fb61merge.1): - - FBLazyVector (= 0.61.5-microsoft-fb61merge.1) + - RCTRequired (1000.0.0) + - RCTTypeSafety (1000.0.0): + - FBLazyVector (= 1000.0.0) - Folly (= 2018.10.22.00) - - RCTRequired (= 0.61.5-microsoft-fb61merge.1) - - React-Core (= 0.61.5-microsoft-fb61merge.1) - - React (0.61.5-microsoft-fb61merge.1): - - React-Core (= 0.61.5-microsoft-fb61merge.1) - - React-Core/DevSupport (= 0.61.5-microsoft-fb61merge.1) - - React-Core/RCTWebSocket (= 0.61.5-microsoft-fb61merge.1) - - React-RCTActionSheet (= 0.61.5-microsoft-fb61merge.1) - - React-RCTAnimation (= 0.61.5-microsoft-fb61merge.1) - - React-RCTBlob (= 0.61.5-microsoft-fb61merge.1) - - React-RCTImage (= 0.61.5-microsoft-fb61merge.1) - - React-RCTLinking (= 0.61.5-microsoft-fb61merge.1) - - React-RCTNetwork (= 0.61.5-microsoft-fb61merge.1) - - React-RCTSettings (= 0.61.5-microsoft-fb61merge.1) - - React-RCTText (= 0.61.5-microsoft-fb61merge.1) - - React-RCTVibration (= 0.61.5-microsoft-fb61merge.1) - - React-ART (0.61.5-microsoft-fb61merge.1): - - React-Core/ARTHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-Core (0.61.5-microsoft-fb61merge.1): + - RCTRequired (= 1000.0.0) + - React-Core (= 1000.0.0) + - React (1000.0.0): + - React-Core (= 1000.0.0) + - React-Core/DevSupport (= 1000.0.0) + - React-Core/RCTWebSocket (= 1000.0.0) + - React-RCTActionSheet (= 1000.0.0) + - React-RCTAnimation (= 1000.0.0) + - React-RCTBlob (= 1000.0.0) + - React-RCTImage (= 1000.0.0) + - React-RCTLinking (= 1000.0.0) + - React-RCTNetwork (= 1000.0.0) + - React-RCTSettings (= 1000.0.0) + - React-RCTText (= 1000.0.0) + - React-RCTVibration (= 1000.0.0) + - React-ART (1000.0.0): + - React-Core/ARTHeaders (= 1000.0.0) + - React-Core (1000.0.0): - Folly (= 2018.10.22.00) - glog - - React-Core/Default (= 0.61.5-microsoft-fb61merge.1) - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-Core/Default (= 1000.0.0) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/ARTHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/ARTHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/CoreModulesHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/CoreModulesHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/Default (0.61.5-microsoft-fb61merge.1): + - React-Core/Default (1000.0.0): - Folly (= 2018.10.22.00) - glog - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/DevSupport (0.61.5-microsoft-fb61merge.1): + - React-Core/DevSupport (1000.0.0): - Folly (= 2018.10.22.00) - glog - - React-Core/Default (= 0.61.5-microsoft-fb61merge.1) - - React-Core/RCTWebSocket (= 0.61.5-microsoft-fb61merge.1) - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) - - React-jsinspector (= 0.61.5-microsoft-fb61merge.1) + - React-Core/Default (= 1000.0.0) + - React-Core/RCTWebSocket (= 1000.0.0) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-jsinspector (= 1000.0.0) - Yoga - - React-Core/RCTActionSheetHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTActionSheetHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTAnimationHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTAnimationHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTBlobHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTBlobHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTImageHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTImageHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTLinkingHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTLinkingHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTNetworkHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTNetworkHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTPushNotificationHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTPushNotificationHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTSettingsHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTSettingsHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTTextHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTTextHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTVibrationHeaders (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTVibrationHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog - React-Core/Default - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-Core/RCTWebSocket (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTWebSocket (1000.0.0): - Folly (= 2018.10.22.00) - glog - - React-Core/Default (= 0.61.5-microsoft-fb61merge.1) - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-Core/Default (= 1000.0.0) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - Yoga - - React-CoreModules (0.61.5-microsoft-fb61merge.1): - - FBReactNativeSpec (= 0.61.5-microsoft-fb61merge.1) + - React-CoreModules (1000.0.0): + - FBReactNativeSpec (= 1000.0.0) - Folly (= 2018.10.22.00) - - RCTTypeSafety (= 0.61.5-microsoft-fb61merge.1) - - React-Core/CoreModulesHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTImage (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/turbomodule/core (= 0.61.5-microsoft-fb61merge.1) - - React-cxxreact (0.61.5-microsoft-fb61merge.1): + - RCTTypeSafety (= 1000.0.0) + - React-Core/CoreModulesHeaders (= 1000.0.0) + - React-RCTImage (= 1000.0.0) + - ReactCommon/turbomodule/core (= 1000.0.0) + - React-cxxreact (1000.0.0): - boost-for-react-native (= 1.63.0) - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-jsinspector (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (0.61.5-microsoft-fb61merge.1): + - React-jsinspector (= 1000.0.0) + - React-jsi (1000.0.0): - boost-for-react-native (= 1.63.0) - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-jsi/Default (= 0.61.5-microsoft-fb61merge.1) - - React-jsi/Default (0.61.5-microsoft-fb61merge.1): + - React-jsi/Default (= 1000.0.0) + - React-jsi/Default (1000.0.0): - boost-for-react-native (= 1.63.0) - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-jsiexecutor (0.61.5-microsoft-fb61merge.1): + - React-jsiexecutor (1000.0.0): - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-jsinspector (0.61.5-microsoft-fb61merge.1) - - React-RCTActionSheet (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTActionSheetHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTAnimation (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTAnimationHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTBlob (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTBlobHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-Core/RCTWebSocket (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - React-RCTNetwork (= 0.61.5-microsoft-fb61merge.1) - - React-RCTImage (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTImageHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTNetwork (= 0.61.5-microsoft-fb61merge.1) - - React-RCTLinking (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTLinkingHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTNetwork (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTNetworkHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTPushNotification (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTPushNotificationHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTSettings (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTSettingsHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTTest (0.61.5-microsoft-fb61merge.1): - - React-Core (= 0.61.5-microsoft-fb61merge.1) - - React-RCTText (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTTextHeaders (= 0.61.5-microsoft-fb61merge.1) - - React-RCTVibration (0.61.5-microsoft-fb61merge.1): - - React-Core/RCTVibrationHeaders (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/jscallinvoker (0.61.5-microsoft-fb61merge.1): + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsinspector (1000.0.0) + - React-RCTActionSheet (1000.0.0): + - React-Core/RCTActionSheetHeaders (= 1000.0.0) + - React-RCTAnimation (1000.0.0): + - React-Core/RCTAnimationHeaders (= 1000.0.0) + - React-RCTBlob (1000.0.0): + - React-Core/RCTBlobHeaders (= 1000.0.0) + - React-Core/RCTWebSocket (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-RCTNetwork (= 1000.0.0) + - React-RCTImage (1000.0.0): + - React-Core/RCTImageHeaders (= 1000.0.0) + - React-RCTNetwork (= 1000.0.0) + - React-RCTLinking (1000.0.0): + - React-Core/RCTLinkingHeaders (= 1000.0.0) + - React-RCTNetwork (1000.0.0): + - React-Core/RCTNetworkHeaders (= 1000.0.0) + - React-RCTPushNotification (1000.0.0): + - React-Core/RCTPushNotificationHeaders (= 1000.0.0) + - React-RCTSettings (1000.0.0): + - React-Core/RCTSettingsHeaders (= 1000.0.0) + - React-RCTTest (1000.0.0): + - React-Core (= 1000.0.0) + - React-RCTText (1000.0.0): + - React-Core/RCTTextHeaders (= 1000.0.0) + - React-RCTVibration (1000.0.0): + - React-Core/RCTVibrationHeaders (= 1000.0.0) + - ReactCommon/jscallinvoker (1000.0.0): - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/turbomodule/core (0.61.5-microsoft-fb61merge.1): + - React-cxxreact (= 1000.0.0) + - ReactCommon/turbomodule/core (1000.0.0): - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-Core (= 0.61.5-microsoft-fb61merge.1) - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/jscallinvoker (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/turbomodule/samples (0.61.5-microsoft-fb61merge.1): + - React-Core (= 1000.0.0) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - ReactCommon/jscallinvoker (= 1000.0.0) + - ReactCommon/turbomodule/samples (1000.0.0): - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-Core (= 0.61.5-microsoft-fb61merge.1) - - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) - - React-jsi (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/jscallinvoker (= 0.61.5-microsoft-fb61merge.1) - - ReactCommon/turbomodule/core (= 0.61.5-microsoft-fb61merge.1) + - React-Core (= 1000.0.0) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - ReactCommon/jscallinvoker (= 1000.0.0) + - ReactCommon/turbomodule/core (= 1000.0.0) - Yoga (1.14.0) DEPENDENCIES: @@ -348,33 +348,33 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 DoubleConversion: a1bc12a74baa397a2609e0f10e19b8062d864053 - FBLazyVector: 5dfe164c4ecb355c7c99cd823e1d84ff1a5788bc - FBReactNativeSpec: 28b8ea431b593568368273a8351d3626b7072b76 + FBLazyVector: bfe273b6a7cf528750dcc4e053d9cc85436024d3 + FBReactNativeSpec: def0592c6a91fd212df4d35414f20a146018948f Folly: feff29ba9d0b7c2e4f793a94942831d6cc5bbad7 glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00 - RCTRequired: a92bf3036ee83300f125e3ee403252f551293faf - RCTTypeSafety: 894595ede98c88e05ee2032f4316e30a07c909d0 - React: 1a7744d3583f828c5b368d97bc1d6883c3ef5061 - React-ART: 55140fce0343403c2673714c647dcce3197a3e21 - React-Core: f9055a8a893057ebbb2d6c23760e3f6ef79d68fb - React-CoreModules: b9bb34399e89d5e0377318e133da1ac378931f39 - React-cxxreact: c0472143c05562852bf9733164bc4df083267b0e - React-jsi: e72668b938c2fa510bcd1512ba57428a85bda150 - React-jsiexecutor: dd2f155314ab1298d2de1552aab62293e91ecb90 - React-jsinspector: cd6ba3c471eb2bc85907e6b34b330efe932bf841 - React-RCTActionSheet: d2286019562b8d450539169bd8e652c2a1e89339 - React-RCTAnimation: cb5a777cb6d0da54b17d1466c6fd6851a468cd89 - React-RCTBlob: b108e5553a9a1c6876d88e6e896ec766f2160b06 - React-RCTImage: 1110fc0018a3689e19033373eff412aad9855e0e - React-RCTLinking: 69e440dda05ef2a05475b6f59d6ae13df3fc0897 - React-RCTNetwork: 24ea076fa72d5268f040154908794da9f1de4677 - React-RCTPushNotification: 23dad6b2aed72c0314de77d69dcd71e5c4471b78 - React-RCTSettings: ca6bee2469300226003a53a29eaac57be1e2c918 - React-RCTTest: 054f7afca584b04069b25cde0570494d5824336d - React-RCTText: 8d5cf19c48793405597b7ac85e71ae48606fcf0c - React-RCTVibration: c1d3ddc2070a3bee4b0c8d8653393ca0ff976dc7 - ReactCommon: 7571c31a09af5ea4d3f0bf2bc4c64b4442ff300c - Yoga: 8e1634114a2a688230bce816fa00459aaa088671 + RCTRequired: f839950291595872a28bdc86fcf2a282705eaf24 + RCTTypeSafety: c02bc2a168a9db9be246e226dc9fb576575c5bc1 + React: a5cab1d42a8dc74440f0df913f44112871d9bc2c + React-ART: 32df9a961a245f798e5fb130c1444aa82de596ee + React-Core: e67c89831fa0fe28f566adaa26cb0cb1715eb629 + React-CoreModules: c3cba5fa7317046f109eb6e009fa28058a878195 + React-cxxreact: 00807e20eb1c3405ce1b965466dadc7bfec521ad + React-jsi: 87033eb3052f4e6b8bf54af32c8f0a29ffbec13c + React-jsiexecutor: 9af31e4fb3c7157d6437d11a4686974ffd5310b7 + React-jsinspector: bd0f3d1d100ec90008bdceeecc3b2ccde15f349c + React-RCTActionSheet: 7303f0bb1d029f90cb097895745094160250b3cf + React-RCTAnimation: 51176f7ca3863005d258fd5f2355b9c5cb58f994 + React-RCTBlob: 3cea68f944215d8f56351aca826359d24ba7f461 + React-RCTImage: aac6ac00bbf4a363dd9966b6798da5f1ce7b23f9 + React-RCTLinking: dd16d814cb622360a9d8293fabd56d15944aa8fc + React-RCTNetwork: 14be59a133cc53d232487471f95a20e7422289a4 + React-RCTPushNotification: 9b99892db307ff8d8a9d71f626eea71d7dbafafd + React-RCTSettings: cfe3330a8147c918c34b8f654ef0ca3d9da0f175 + React-RCTTest: 6621c76066fa0c1293149d06c2bf2d5b06be6956 + React-RCTText: 412d94e0ae9abe569464155758af496fee825822 + React-RCTVibration: 54b19bd58ac1386bdcdf55a1970a5132dc36200b + ReactCommon: fd074e83fbe23c2c5f36326d9c4e36bb5a88770e + Yoga: 8fc57194b91c380c2d89502fda5cae5e092b05f5 PODFILE CHECKSUM: c0ee8fa1224b483cb7f0297981cb8fe4813aa299 diff --git a/RNTester/RNTester-macOS/AppDelegate.m b/RNTester/RNTester-macOS/AppDelegate.m index 0a2a4a6fecd429..153d90aba5c1d2 100644 --- a/RNTester/RNTester-macOS/AppDelegate.m +++ b/RNTester/RNTester-macOS/AppDelegate.m @@ -12,6 +12,7 @@ #import #import #import +#import const NSString *kBundleNameJS = @"RNTesterApp"; @@ -30,6 +31,10 @@ - (void)awakeFromNib _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil]; + + // Optionally set the global `fontSmoothing` setting. + // If not explicitly set, the default is subpixel-antialiased + [RCTTextAttributes setFontSmoothingDefault:RCTFontSmoothingSubpixelAntialiased]; } - (void)applicationWillFinishLaunching:(NSNotification *)__unused aNotification diff --git a/RNTester/RNTester/AppDelegate.mm b/RNTester/RNTester/AppDelegate.mm index f390405d3db047..d7bd0a08bfc0aa 100644 --- a/RNTester/RNTester/AppDelegate.mm +++ b/RNTester/RNTester/AppDelegate.mm @@ -28,6 +28,7 @@ #endif #import +#import // TODO(OSS Candidate ISS#2710739) #import "RNTesterTurboModuleProvider.h" @@ -50,6 +51,12 @@ - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWith _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; + // [TODO(OSS Candidate ISS#2710739) + // Optionally set the global `fontSmoothing` setting. + // If not explicitly set, the default is subpixel-antialiased + [RCTTextAttributes setFontSmoothingDefault:RCTFontSmoothingSubpixelAntialiased]; + // ]TODO(OSS Candidate ISS#2710739) + // Appetizer.io params check NSDictionary *initProps = @{}; NSString *_routeUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"route"]; diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 6ba1c72de992a1..55ea6cb11b1564 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -48,9 +48,6 @@ 383838E0244BC5A0005FAC75 /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215F22B2F3EC005AC45F /* RCTUIManagerScenarioTests.m */; }; 383838E1244BC5A4005FAC75 /* RNTesterSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB216022B2F3EC005AC45F /* RNTesterSnapshotTests.m */; }; 383838E2244BC5A8005FAC75 /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */; }; - 38784804245633870035033A /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38784803245633870035033A /* libPods-RNTester.a */; }; - 38784806245633A90035033A /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38784805245633A90035033A /* libPods-RNTester.a */; }; - 38784808245633B70035033A /* libPods-RNTester-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38784807245633B70035033A /* libPods-RNTester-macOS.a */; }; 3882C0E22445657000E92FB9 /* OCMock.framework in Copy Files (1 item) */ = {isa = PBXBuildFile; fileRef = 38A93816244532460025DABB /* OCMock.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 38A9383C244532470025DABB /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38A9381B244532460025DABB /* libOCMock.a */; }; 38B2630B2444F5EB006AB4D5 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; @@ -188,9 +185,6 @@ 387847D1245631D80035033A /* libiosDeviceBuild.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libiosDeviceBuild.a; sourceTree = BUILT_PRODUCTS_DIR; }; 387847DE245631F50035033A /* libiosSimulatorBuild.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libiosSimulatorBuild.a; sourceTree = BUILT_PRODUCTS_DIR; }; 387847EB2456320C0035033A /* libmacOSBuild.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmacOSBuild.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 38784803245633870035033A /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 38784805245633A90035033A /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 38784807245633B70035033A /* libPods-RNTester-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 38A93816244532460025DABB /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCMock.framework; sourceTree = ""; }; 38A9381B244532460025DABB /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = ""; }; 38BB7CB524455C4100803CDE /* libPods-RNTester-macOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester-macOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -315,7 +309,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 38784804245633870035033A /* libPods-RNTester.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -323,7 +316,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 38784806245633A90035033A /* libPods-RNTester.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -331,7 +323,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 38784808245633B70035033A /* libPods-RNTester-macOS.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -426,9 +417,6 @@ 2DE7E7D81FB2A4F3009E225D /* Frameworks */ = { isa = PBXGroup; children = ( - 38784807245633B70035033A /* libPods-RNTester-macOS.a */, - 38784805245633A90035033A /* libPods-RNTester.a */, - 38784803245633870035033A /* libPods-RNTester.a */, 38BB7CB524455C4100803CDE /* libPods-RNTester-macOSTests.a */, E7DB218B22B41FCD005AC45F /* XCTest.framework */, E7DB213022B2C649005AC45F /* JavaScriptCore.framework */, diff --git a/RNTester/js/examples/Text/TextExample.ios.js b/RNTester/js/examples/Text/TextExample.ios.js index 8b28c6dfb26756..542838edea06f4 100644 --- a/RNTester/js/examples/Text/TextExample.ios.js +++ b/RNTester/js/examples/Text/TextExample.ios.js @@ -458,6 +458,43 @@ exports.title = ''; exports.description = 'Base component for rendering styled text.'; exports.displayName = 'TextExample'; exports.examples = [ + // [TODO(OSS Candidate ISS#2710739) + { + title: 'Apple Font Smoothing', + render: function(): React.Node { + return ( + + + auto: + + This will render using the global [RCTTextAttributes + fontSmoothingDefault] setting. The default is the same as + subpixel-antialiased if not explicitly set by the native app. + + + + none: + + This will render with no antialiasing. + + + + antialiased: + + This will render with antialiasing. + + + + subpixel-antialiased: + + This will render with subpixel antialiasing. + + + + ); + }, + }, + // ]TODO(OSS Candidate ISS#2710739) { title: 'Wrap', render: function(): React.Node { diff --git a/React/Base/RCTConvert.h b/React/Base/RCTConvert.h index 4c42ad4b899678..80001a94a7a4d7 100644 --- a/React/Base/RCTConvert.h +++ b/React/Base/RCTConvert.h @@ -14,6 +14,7 @@ #import #import #import +#import // TODO(OSS Candidate ISS#2710739) #import #if TARGET_OS_IPHONE && WEBKIT_IOS_10_APIS_AVAILABLE #import @@ -140,6 +141,7 @@ typedef BOOL css_backface_visibility_t; + (RCTAnimationType)RCTAnimationType:(id)json; + (RCTBorderStyle)RCTBorderStyle:(id)json; + (RCTTextDecorationLineType)RCTTextDecorationLineType:(id)json; ++ (RCTFontSmoothing)RCTFontSmoothing:(id)json; // TODO(OSS Candidate ISS#2710739) #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) + (NSString *)accessibilityRoleFromTraits:(id)json; diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index 61887e743c9b98..fe4f7689976fa7 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -327,6 +327,15 @@ + (NSLocale *)NSLocale:(id)json @"underline line-through": @(RCTTextDecorationLineTypeUnderlineStrikethrough), }), RCTTextDecorationLineTypeNone, integerValue) +// [TODO(OSS Candidate ISS#2710739) +RCT_ENUM_CONVERTER(RCTFontSmoothing, (@{ + @"auto": @(RCTFontSmoothingAuto), + @"none": @(RCTFontSmoothingNone), + @"antialiased": @(RCTFontSmoothingAntialiased), + @"subpixel-antialiased": @(RCTFontSmoothingSubpixelAntialiased), +}), RCTFontSmoothingAuto, integerValue) +// ]TODO(OSS Candidate ISS#2710739) + RCT_ENUM_CONVERTER(NSWritingDirection, (@{ @"auto": @(NSWritingDirectionNatural), @"ltr": @(NSWritingDirectionLeftToRight), diff --git a/React/Views/RCTFontSmoothing.h b/React/Views/RCTFontSmoothing.h new file mode 100644 index 00000000000000..a520f04eecd0ae --- /dev/null +++ b/React/Views/RCTFontSmoothing.h @@ -0,0 +1,17 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// TODO(OSS Candidate ISS#2710739) + +#import + +typedef NS_ENUM(NSInteger, RCTFontSmoothing) { + RCTFontSmoothingAuto = 0, + RCTFontSmoothingNone, + RCTFontSmoothingAntialiased, + RCTFontSmoothingSubpixelAntialiased, +}; \ No newline at end of file