Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 250
vooku Avatar asked Oct 25 '25 14:10

vooku


2 Answers

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.

like image 162
Ebrahim Byagowi Avatar answered Oct 27 '25 03:10

Ebrahim Byagowi


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.

like image 22
Axel Avatar answered Oct 27 '25 02:10

Axel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!