You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/03/02 03:23:31 UTC
[2/4] incubator-weex git commit: + [ios] because rax transform number
to native, the text weight will lose effect
+ [ios] because rax transform number to native,the text weight will lose effect
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7ec9dfbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7ec9dfbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7ec9dfbd
Branch: refs/heads/0.11-dev
Commit: 7ec9dfbdb7469b6be6fc23d1a166691e0973d1a6
Parents: fa1c8b0
Author: kfeagle <su...@163.com>
Authored: Wed Mar 1 20:07:28 2017 +0800
Committer: kfeagle <su...@163.com>
Committed: Wed Mar 1 20:07:28 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 52 ++++++++++++------------
1 file changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7ec9dfbd/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
index c497d28..b0de541 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
@@ -503,32 +503,32 @@ WX_NUMBER_CONVERT(NSUInteger, unsignedIntegerValue)
+ (CGFloat)WXTextWeight:(id)value
{
- if([value isKindOfClass:[NSString class]]){
- NSString *string = (NSString *)value;
- if ([string isEqualToString:@"normal"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
- else if ([string isEqualToString:@"bold"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
- else if ([string isEqualToString:@"100"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.8:UIFontWeightUltraLight;
- else if ([string isEqualToString:@"200"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.6:UIFontWeightThin;
- else if ([string isEqualToString:@"300"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.4:UIFontWeightLight;
- else if ([string isEqualToString:@"400"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
- else if ([string isEqualToString:@"500"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.23:UIFontWeightMedium;
- else if ([string isEqualToString:@"600"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.3:UIFontWeightSemibold;
- else if ([string isEqualToString:@"700"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
- else if ([string isEqualToString:@"800"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.56:UIFontWeightHeavy;
- else if ([string isEqualToString:@"900"])
- return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.62:UIFontWeightBlack;
-
- }
+ NSString *string = [WXConvert NSString:value];
+ if (!string)
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
+ else if ([string isEqualToString:@"normal"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
+ else if ([string isEqualToString:@"bold"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
+ else if ([string isEqualToString:@"100"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.8:UIFontWeightUltraLight;
+ else if ([string isEqualToString:@"200"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.6:UIFontWeightThin;
+ else if ([string isEqualToString:@"300"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.4:UIFontWeightLight;
+ else if ([string isEqualToString:@"400"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
+ else if ([string isEqualToString:@"500"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.23:UIFontWeightMedium;
+ else if ([string isEqualToString:@"600"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.3:UIFontWeightSemibold;
+ else if ([string isEqualToString:@"700"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
+ else if ([string isEqualToString:@"800"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.56:UIFontWeightHeavy;
+ else if ([string isEqualToString:@"900"])
+ return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.62:UIFontWeightBlack;
+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
}