Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -292,7 +292,15 @@ export type FontVariant =
| 'oldstyle-nums'
| 'lining-nums'
| 'tabular-nums'
| 'proportional-nums';
| 'proportional-nums'
| 'common-ligatures'
| 'no-common-ligatures'
| 'discretionary-ligatures'
| 'no-discretionary-ligatures'
| 'historical-ligatures'
| 'no-historical-ligatures'
| 'contextual'
| 'no-contextual';
export interface TextStyleIOS extends ViewStyle {
fontVariant?: FontVariant[] | undefined;
textDecorationColor?: ColorValue | undefined;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -788,6 +788,14 @@ export type ____FontVariantArray_Internal = $ReadOnlyArray<
| 'oldstyle-nums'
| 'lining-nums'
| 'tabular-nums'
| 'common-ligatures'
| 'no-common-ligatures'
| 'discretionary-ligatures'
| 'no-discretionary-ligatures'
| 'historical-ligatures'
| 'no-historical-ligatures'
| 'contextual'
| 'no-contextual'
| 'proportional-nums'
| 'stylistic-one'
| 'stylistic-two'
Expand Down
32 changes: 32 additions & 0 deletions packages/react-native/React/Views/RCTFont.mm
Original file line numberDiff line numberDiff line change
Expand Up@@ -248,6 +248,38 @@ + (RCTFontVariantDescriptor *)RCTFontVariantDescriptor:(id)json
UIFontFeatureTypeIdentifierKey : @(kNumberSpacingType),
UIFontFeatureSelectorIdentifierKey : @(kProportionalNumbersSelector),
},
@"common-ligatures" : @{
UIFontFeatureTypeIdentifierKey : @(kLigaturesType),
UIFontFeatureSelectorIdentifierKey : @(kCommonLigaturesOnSelector),
},
@"no-common-ligatures" : @{
UIFontFeatureTypeIdentifierKey : @(kLigaturesType),
UIFontFeatureSelectorIdentifierKey : @(kCommonLigaturesOffSelector),
},
@"discretionary-ligatures" : @{
UIFontFeatureTypeIdentifierKey : @(kLigaturesType),
UIFontFeatureSelectorIdentifierKey : @(kRareLigaturesOnSelector),
},
@"no-discretionary-ligatures" : @{
UIFontFeatureTypeIdentifierKey : @(kLigaturesType),
UIFontFeatureSelectorIdentifierKey : @(kRareLigaturesOffSelector),
},
@"historical-ligatures" : @{
UIFontFeatureTypeIdentifierKey : @(kLigaturesType),
UIFontFeatureSelectorIdentifierKey : @(kHistoricalLigaturesOnSelector),
},
@"no-historical-ligatures" : @{
UIFontFeatureTypeIdentifierKey : @(kLigaturesType),
UIFontFeatureSelectorIdentifierKey : @(kHistoricalLigaturesOffSelector),
},
@"contextual" : @{
UIFontFeatureTypeIdentifierKey : @(kContextualAlternatesType),
UIFontFeatureSelectorIdentifierKey : @(kContextualAlternatesOnSelector),
},
@"no-contextual" : @{
UIFontFeatureTypeIdentifierKey : @(kContextualAlternatesType),
UIFontFeatureSelectorIdentifierKey : @(kContextualAlternatesOffSelector),
},
@"stylistic-one" : @{
UIFontFeatureTypeIdentifierKey : @(kStylisticAlternativesType),
UIFontFeatureSelectorIdentifierKey : @(kStylisticAltOneOnSelector),
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,6 +85,32 @@ public static int parseFontStyle(@Nullable String fontStyleString) {
case "proportional-nums":
features.add("'pnum'");
break;
case "common-ligatures":
features.add("'liga'");
features.add("'clig'");
break;
case "no-common-ligatures":
features.add("'liga' off");
features.add("'clig' off");
break;
case "discretionary-ligatures":
features.add("'dlig'");
break;
case "no-discretionary-ligatures":
features.add("'dlig' off");
break;
case "historical-ligatures":
features.add("'hlig'");
break;
case "no-historical-ligatures":
features.add("'hlig' off");
break;
case "contextual":
features.add("'calt'");
break;
case "no-contextual":
features.add("'calt' off");
break;
case "stylistic-one":
features.add("'ss01'");
break;
Expand Down