在 Apple Color Emoji 中使用 Harfbuzz 和 Freetype 的表情符号修饰符和 ZWJ 序列

Emoji modifiers & ZWJ sequences using Harfbuzz & Freetype in Apple Color Emoji

我正在使用 Freetype 1.9.1 和 Harfbuzz 1.7.6 渲染可能包含表情符号的文本,但是我不知道如何正确渲染表情符号修饰符和来自 Apple Color Emoji 的 ZWJ 序列 (sbix彩色字体)。

我也尝试过 Noto Color Emoji(CBDT/CBLC color font), which works as expected, and Segoe UI Emoji (COLR/CPAL color font), which renders black & white glyphs, however it seems that support for COLR/CPAL is just being developed 在 Freetype 中,因此对我来说不是问题。

有没有人有关于使用 sbix 字体要注意什么的提示?集群类型? Harfbuzz 旗帜...?

Expected behaviour

Apple Color Emoji -- not OK

Noto Color Emoji -- OK

我对文本整形还很陌生,但我设法使用 Harfbuzz 和 Cairo 将表情符号(带有修饰符和 ZWJ)显示到 SDL2 window。

GitHub Repository.

根据你说的,主要区别是我使用的是HarfBuzz 1.8.2版本。

HarfBuzz 逐渐改进了对不同序列的支持,现在可以可靠地用于不同的 Emoji 修饰符和序列。

此外,v2.1.0 添加了对所有可用表情符号文件格式的支持,简单明了 API,https://github.com/harfbuzz/harfbuzz/blob/master/src/hb-ot-color.h of course rendering parts still will be up to you (or use freetype to render then) but you don't have to deal with font structures at least anymore given the simple to use API which https://github.com/harfbuzz/harfbuzz/blob/1934652/src/main.cc#L46-L247 也是如何使用 APIs.