Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Fix CTFont changed under xcode11 build. (#2936)
Browse files Browse the repository at this point in the history
Issue: #2935
  • Loading branch information
sunshl authored and jianhan-he committed Sep 26, 2019
1 parent 7548ba6 commit 344bb3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ios/sdk/WeexSDK/Sources/Component/WXTextComponent.mm
Expand Up @@ -504,9 +504,9 @@ - (NSMutableAttributedString *)buildCTAttributeString

if (_fontStyle == WXTextStyleItalic) {
CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(16 * (CGFloat)M_PI / 180), 1, 0, 0);
ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, font.pointSize, &matrix);
ctFont = CTFontCreateWithFontDescriptor((__bridge CTFontDescriptorRef)font.fontDescriptor, font.pointSize, &matrix);
}else {
ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, font.pointSize, NULL);
ctFont = CTFontCreateWithFontDescriptor((__bridge CTFontDescriptorRef)font.fontDescriptor, font.pointSize, NULL);
}

_fontAscender = font.ascender;
Expand Down Expand Up @@ -898,7 +898,7 @@ - (CTLineRef)buildTruncatedLineWithRuns:(CFArrayRef)runs lines:(NSMutableArray*)
CGFloat fontSize = font ? CTFontGetSize(font):32 * self.weexInstance.pixelScaleFactor;
UIFont * uiFont = [UIFont systemFontOfSize:fontSize];
if (uiFont) {
font = CTFontCreateWithName((__bridge CFStringRef)uiFont.fontName, uiFont.pointSize, NULL);
font = CTFontCreateWithFontDescriptor((__bridge CTFontDescriptorRef)uiFont.fontDescriptor, uiFont.pointSize, NULL);
}
if (font) {
attrs[(id)kCTFontAttributeName] = (__bridge id)(font);
Expand Down

0 comments on commit 344bb3f

Please sign in to comment.