Repository: incubator-weex Updated Branches: refs/heads/master 1378f5874 -> a1d4ed2cd
Revert "*[ios]fix CTFont crash on iOS10" This reverts commit a790beddfe60f65935963f693c9f931c86db608d. Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a1d4ed2c Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a1d4ed2c Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a1d4ed2c Branch: refs/heads/master Commit: a1d4ed2cd7e39fe37d46fe831f580d0febad331d Parents: 1378f58 Author: acton393 <zhangxing610...@gmail.com> Authored: Wed Mar 21 15:46:50 2018 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Wed Mar 21 15:46:50 2018 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a1d4ed2c/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m index f4211bd..042f0a6 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m @@ -464,8 +464,12 @@ do {\ // set font UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor useCoreText:[self useCoreText]]; - if (font) { - [attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, string.length)]; + CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, + font.pointSize, + NULL); + if (ctFont) { + [attributedString addAttribute:(id)kCTFontAttributeName value:(__bridge id)(ctFont) range:NSMakeRange(0, string.length)]; + CFRelease(ctFont); } if(_textDecoration == WXTextDecorationUnderline){