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

Fix CTFont changed under xcode11 build. #2936

Merged
merged 1 commit into from
Sep 26, 2019
Merged
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
6 changes: 3 additions & 3 deletions ios/sdk/WeexSDK/Sources/Component/WXTextComponent.mm
Original file line number Diff line number Diff line change
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