Fixed #43 CTFontCreateWithName() warning on iOS 13 #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed #43
CTFontCreateWithName(".SFUI-Regular")
在 iOS 13 之前会返回.SFUIText-Regular
这个字体,iOS 13 会返回Times New Roman
这个字体,并且会输出警告:Ref from: Cocoanetics/DTCoreText#1168 (comment)
苹果意思是不要直接使用 (.) 开头的字体名。
修复方案 1: 使用
CTFontCreateWithFontDescriptor
创建 CTFont修复方案 2:因为 UIFont 和 CTFont 是 toll-free bridged 的,UIFont 其实就是 CTFont,所以可以在任何需要使用 CTFont 的地方类型转换 UIFont 即可:
(__bridge CTFontRef)self.font