在 iOS 13.1 上要求不同大小的 San Francisco 字体 returns Times New Roman 变体
Asking for San Francisco font in different size returns a Times New Roman variant on iOS 13.1
执行此操作时:
let l = UILabel()
let f = l.font!
let f8 = UIFont(name: f.fontName, size: f.pointSize + 8)!
NSLog("\(f.fontName)")
NSLog("\(f8.fontName)")
日志输出:
.SFUI-Regular
TimesNewRomanPSMT
当我要求使用相同的字体但更大一点时,为什么我不再获得 San Francisco 变体?这是 iOS 中的错误吗?
当我做的时候
let f8 = f.withSize(f.pointSize + 8)
相反,我得到了 .SFUI-Regular。
使用 f.familyName
而不是 f.fontName
姓氏:https://developer.apple.com/documentation/uikit/uifont/1619033-familyname
字体名称:https://developer.apple.com/documentation/uikit/uifont/1619024-fontname
此外,来自 init(name:size)
的字体名称必须包含全名,包括 familyName:https://developer.apple.com/documentation/uikit/uifont/1619041-init
执行此操作时:
let l = UILabel()
let f = l.font!
let f8 = UIFont(name: f.fontName, size: f.pointSize + 8)!
NSLog("\(f.fontName)")
NSLog("\(f8.fontName)")
日志输出:
.SFUI-Regular
TimesNewRomanPSMT
当我要求使用相同的字体但更大一点时,为什么我不再获得 San Francisco 变体?这是 iOS 中的错误吗?
当我做的时候
let f8 = f.withSize(f.pointSize + 8)
相反,我得到了 .SFUI-Regular。
使用 f.familyName
而不是 f.fontName
姓氏:https://developer.apple.com/documentation/uikit/uifont/1619033-familyname
字体名称:https://developer.apple.com/documentation/uikit/uifont/1619024-fontname
此外,来自 init(name:size)
的字体名称必须包含全名,包括 familyName:https://developer.apple.com/documentation/uikit/uifont/1619041-init