gpt4 book ai didi

swift - 如何显示彩色表情符号

转载 作者:可可西里 更新时间:2023-11-01 00:39:24 26 4
gpt4 key购买 nike

我的代码:

let myemoji = "\u{2049}"
let another = "\u{2757}"

Playground 结果:

enter image description here

Unicode U+2049 不会生成像这样的红色表情符号 ⁉️。这种颜色有什么特别要添加的吗?

最佳答案

一些字符可以显示为“文本”或“表情符号”,并且“Unicode VARIATION SELECTOR”可用于控制演示。示例:

print("text presentation:  \u{2049}  \u{25B6}")
print("emoji presentation: \u{2049}\u{FE0F} \u{25B6}\u{FE0F}")

结果:

enter image description here

有关详细信息,请参阅 1.4.3 Emoji and Text Presentation Sequences :

ED-8. text presentation selector — The character U+FE0E VARIATION SELECTOR-15, used to request a text presentation for an emoji character. (Also known as text variation selector in prior versions of this specification.)

ED-9. emoji presentation selector — The character U+FE0F VARIATION SELECTOR-16, used to request an emoji presentation for an emoji character. (Also known as emoji variation selector in prior versions of this specification.)

Variation Selector-16 :

An invisible codepoint which specifies that the preceding character should be displayed with emoji presentation. Only required if the preceding character defaults to text presentation.

关于swift - 如何显示彩色表情符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48534667/

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