Emoji modifiers & ZWJ sequences using Harfbuzz & F

2019-08-08 08:52发布

问题:

I'm using Freetype 1.9.1 and Harfbuzz 1.7.6 to render text possibly including emoji, however I don't know how to correctly render emoji modifiers and ZWJ sequencces from Apple Color Emoji (sbix color font).

I've also tried 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 in Freetype and therefore is not an issue for me.

Has anyone any tips on what to look out for with the sbix font? Cluster types? Harfbuzz flags...?

Expected behaviour

Apple Color Emoji -- not OK

Noto Color Emoji -- OK

回答1:

HarfBuzz gradually improved different sequences support and now is reliable to be used different Emoji modifier and sequences.

In addition to that, v2.1.0 added support to all the available Emoji file formats with a simple and concise API, https://github.com/harfbuzz/harfbuzz/blob/master/src/hb-ot-color.h of course rendering parts still will be up to you 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/master/src/test-ot-color.cc is also a good example on how to use the APIs.



回答2:

I am pretty new to text shaping, but I managed, using Harfbuzz and Cairo to display emoji (with modifiers and ZWJ) onto a SDL2 window.

GitHub Repository.

Based on what you said, the main difference is that I used HarfBuzz version 1.8.2.