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

1.8k Views Asked by At

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

2

There are 2 best solutions below

0
On BEST ANSWER

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.

1
On

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.

enter image description here

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