gpt4 book ai didi

ios - 在 iOS 8+ 中使用什么字体显示这些 un​​icode 字符

转载 作者:搜寻专家 更新时间:2023-10-31 22:19:37 24 4
gpt4 key购买 nike

我正在使用系统中可用的 Arial 字体来显示一些 unicode 字符,并且能够显示除以下属于箭头类别的符号之外的大多数字符:

⟼、⤎、⤏

对应的unicode是:\u{27FC},\u{290E},\u{290F}

我在 UIButton 上显示它们。知道什么字体在 iOS 8 及更高版本上支持这些 un​​icode 字符吗?

它显示问号,因为 Arial 不支持这些字形,这是屏幕截图:

enter image description here

感谢任何帮助。感谢您的宝贵时间。

最佳答案

答案……恐怕没有。

至少根据这个相当骇人听闻的测试……

extension unichar {
func isSupportedBy(fontName: String) -> Bool {
let characters = [self]
var glyphs: [CGGlyph] = []
let ctFont = CTFontCreateWithName(fontName as CFString, 15, nil)
return CTFontGetGlyphsForCharacters(ctFont, characters, &glyphs, 1)
}
}

UIFont.familyNames.map({
UIFont.fontNames(forFamilyName: $0)
}).joined().forEach({
for string in ["A", "\u{27FC}", "\u{290E}", "\u{290F}"].map({$0.utf16}){
if let char = string.first {
if char.isSupportedBy(fontName: $0) {
print("\($0) supports \(string)")
} else {
print("\($0) does not support \(string)")
}
} else {
print("invalid char \(string)")
}
}
})

Copperplate-Light supports A
Copperplate-Light does not support ⟼
Copperplate-Light does not support ⤎
Copperplate-Light does not support ⤏

etc

编辑:

检查 macOS 中的字符输入窗口,这些特殊字形似乎STIXGeneral-RegularApple Symbols 字体中可用。也许您可以将其中一种作为自定义字体添加到您的 iOS 应用程序中?

enter image description here

关于ios - 在 iOS 8+ 中使用什么字体显示这些 un​​icode 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42812691/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com