diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index 490ef5f306ad18..0ff1d26f64dd29 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -590,7 +590,27 @@ export type ____TextStyle_InternalCore = $ReadOnly<{ | 'oldstyle-nums' | 'lining-nums' | 'tabular-nums' - | 'proportional-nums', + | 'proportional-nums' + | 'stylistic-one' + | 'stylistic-two' + | 'stylistic-three' + | 'stylistic-four' + | 'stylistic-five' + | 'stylistic-six' + | 'stylistic-seven' + | 'stylistic-eight' + | 'stylistic-nine' + | 'stylistic-ten' + | 'stylistic-eleven' + | 'stylistic-twelve' + | 'stylistic-thirteen' + | 'stylistic-fourteen' + | 'stylistic-fifteen' + | 'stylistic-sixteen' + | 'stylistic-seventeen' + | 'stylistic-eighteen' + | 'stylistic-nineteen' + | 'stylistic-twenty', >, textShadowOffset?: $ReadOnly<{ width: number, diff --git a/React/Views/RCTFont.mm b/React/Views/RCTFont.mm index 679f2cea43ebe2..e119657d3716fd 100644 --- a/React/Views/RCTFont.mm +++ b/React/Views/RCTFont.mm @@ -248,6 +248,86 @@ + (RCTFontVariantDescriptor *)RCTFontVariantDescriptor:(id)json UIFontFeatureTypeIdentifierKey : @(kNumberSpacingType), UIFontFeatureSelectorIdentifierKey : @(kProportionalNumbersSelector), }, + @"stylistic-one" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltOneOnSelector), + }, + @"stylistic-two" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltTwoOnSelector), + }, + @"stylistic-three" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltThreeOnSelector), + }, + @"stylistic-four" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltFourOnSelector), + }, + @"stylistic-five" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltFiveOnSelector), + }, + @"stylistic-six" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltSixOnSelector), + }, + @"stylistic-seven" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltSevenOnSelector), + }, + @"stylistic-eight" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltEightOnSelector), + }, + @"stylistic-nine" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltNineOnSelector), + }, + @"stylistic-ten" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltTenOnSelector), + }, + @"stylistic-eleven" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltElevenOnSelector), + }, + @"stylistic-twelve" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltTwelveOnSelector), + }, + @"stylistic-thirteen" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltThirteenOnSelector), + }, + @"stylistic-fourteen" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltFourteenOnSelector), + }, + @"stylistic-fifteen" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltFifteenOnSelector), + }, + @"stylistic-sixteen" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltSixteenOnSelector), + }, + @"stylistic-seventeen" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltSeventeenOnSelector), + }, + @"stylistic-eighteen" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltEighteenOnSelector), + }, + @"stylistic-nineteen" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltNineteenOnSelector), + }, + @"stylistic-twenty" : @{ + UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType), + UIFontFeatureSelectorIdentifierKey : @(kStylisticAltTwentyOnSelector), + } }; }); RCTFontVariantDescriptor *value = mapping[json]; diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java index 76da16072cdeb3..6ca731ef4ff1aa 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java @@ -85,6 +85,66 @@ public static int parseFontStyle(@Nullable String fontStyleString) { case "proportional-nums": features.add("'pnum'"); break; + case "stylistic-one": + features.add("'ss01'"); + break; + case "stylistic-two": + features.add("'ss02'"); + break; + case "stylistic-three": + features.add("'ss03'"); + break; + case "stylistic-four": + features.add("'ss04'"); + break; + case "stylistic-five": + features.add("'ss05'"); + break; + case "stylistic-six": + features.add("'ss06'"); + break; + case "stylistic-seven": + features.add("'ss07'"); + break; + case "stylistic-eight": + features.add("'ss08'"); + break; + case "stylistic-nine": + features.add("'ss09'"); + break; + case "stylistic-ten": + features.add("'ss10'"); + break; + case "stylistic-eleven": + features.add("'ss11'"); + break; + case "stylistic-twelve": + features.add("'ss12'"); + break; + case "stylistic-thirteen": + features.add("'ss13'"); + break; + case "stylistic-fourteen": + features.add("'ss14'"); + break; + case "stylistic-fifteen": + features.add("'ss15'"); + break; + case "stylistic-sixteen": + features.add("'ss16'"); + break; + case "stylistic-seventeen": + features.add("'ss17'"); + break; + case "stylistic-eighteen": + features.add("'ss18'"); + break; + case "stylistic-nineteen": + features.add("'ss19'"); + break; + case "stylistic-twenty": + features.add("'ss20'"); + break; } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java index 8706e70b102b6c..787ab9bb14db4a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java @@ -444,6 +444,66 @@ private void setFontVariant(@Nullable MapBuffer fontVariant) { case "proportional-nums": features.add("'pnum'"); break; + case "stylistic-one": + features.add("'ss01'"); + break; + case "stylistic-two": + features.add("'ss02'"); + break; + case "stylistic-three": + features.add("'ss03'"); + break; + case "stylistic-four": + features.add("'ss04'"); + break; + case "stylistic-five": + features.add("'ss05'"); + break; + case "stylistic-six": + features.add("'ss06'"); + break; + case "stylistic-seven": + features.add("'ss07'"); + break; + case "stylistic-eight": + features.add("'ss08'"); + break; + case "stylistic-nine": + features.add("'ss09'"); + break; + case "stylistic-ten": + features.add("'ss10'"); + break; + case "stylistic-eleven": + features.add("'ss11'"); + break; + case "stylistic-twelve": + features.add("'ss12'"); + break; + case "stylistic-thirteen": + features.add("'ss13'"); + break; + case "stylistic-fourteen": + features.add("'ss14'"); + break; + case "stylistic-fifteen": + features.add("'ss15'"); + break; + case "stylistic-sixteen": + features.add("'ss16'"); + break; + case "stylistic-seventeen": + features.add("'ss17'"); + break; + case "stylistic-eighteen": + features.add("'ss18'"); + break; + case "stylistic-nineteen": + features.add("'ss19'"); + break; + case "stylistic-twenty": + features.add("'ss20'"); + break; } } }