Search code examples
c++emojifreetypeharfbuzz

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


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


Solution

  • HarfBuzz gradually improved different sequences support and now is reliable to be used for different Emoji modifiers and sequences.

    Additionally, v2.1.0 added support to all of 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 (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 is also a good example on how to use the APIs.