From a0a64d0b62aa645df7b2681f6d4c95aaa910fd6e Mon Sep 17 00:00:00 2001 From: Sean Holbert Date: Thu, 7 Sep 2017 12:43:16 -0700 Subject: [PATCH 1/2] Support for DemiBold alias of SemiBold For more information see [this post](https://www.quora.com/What-is-the-difference-between-Medium-Demi-and-Semibold-fonts). DemiBold is fairly common in font naming, and React Native lacks support of "AvNext-DemiBold" for example. --- React/Views/RCTFont.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/React/Views/RCTFont.mm b/React/Views/RCTFont.mm index c75a2b96702fba..32b293bd0f9ad5 100644 --- a/React/Views/RCTFont.mm +++ b/React/Views/RCTFont.mm @@ -50,6 +50,7 @@ static RCTFontWeight weightOfFont(UIFont *font) @"regular", @"medium", @"semibold", + @"demibold", @"bold", @"heavy", @"black" @@ -62,13 +63,14 @@ static RCTFontWeight weightOfFont(UIFont *font) @(UIFontWeightRegular), @(UIFontWeightMedium), @(UIFontWeightSemibold), + @(UIFontWeightSemibold), @(UIFontWeightBold), @(UIFontWeightHeavy), @(UIFontWeightBlack) ]; }); - for (NSInteger i = 0; i < fontNames.count; i++) { + for (NSUInteger i = 0; i < fontNames.count; i++) { if ([font.fontName.lowercaseString hasSuffix:fontNames[i]]) { return (RCTFontWeight)[fontWeights[i] doubleValue]; } From e7ad025300497de4b97c930061a49a7b11bfcba7 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Fri, 8 Sep 2017 21:59:31 -0700 Subject: [PATCH 2/2] Update RCTFont.mm --- React/Views/RCTFont.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Views/RCTFont.mm b/React/Views/RCTFont.mm index 32b293bd0f9ad5..20e86f0f9dfff0 100644 --- a/React/Views/RCTFont.mm +++ b/React/Views/RCTFont.mm @@ -70,7 +70,7 @@ static RCTFontWeight weightOfFont(UIFont *font) ]; }); - for (NSUInteger i = 0; i < fontNames.count; i++) { + for (NSInteger i = 0; i < fontNames.count; i++) { if ([font.fontName.lowercaseString hasSuffix:fontNames[i]]) { return (RCTFontWeight)[fontWeights[i] doubleValue]; }