foliojs / fontkit

An advanced font engine for Node and the browser
1.46k stars 219 forks source link

help with implementing NotoColorEmoji support #211

Closed gojko closed 2 years ago

gojko commented 4 years ago

Hi,

I started working on support for Google's Chrome/Chromebook color scheme for fonts (CBDT/CBLC), which would enable fontkit to work with Noto Emoji.

I got stuck and need a bit of guidance, so I'd appreciate a bit of help very much.

It looks like CBDT/CBLC fonts use PNG images, similarly to Apple's SBIX, but I'm having trouble locating images using CBLC. When loading Noto Color Emoji, it looks like the index subtables are incomplete (the metadata suggests there should be 22 subtables, but the table contains only one). Here's a test that demonstrates the problem:

https://github.com/gojko/fontkit/commit/69fe0b9759dcb6a6d998e7607dc8149555954507#diff-7520f7bb309962ab07d37c60e93daab2R178

Any idea where to start looking next?

yisibl commented 2 years ago

Please consider using the COLRv1 font format, to which Noto Color Emoji is switching. https://github.com/googlefonts/color-fonts.

yisibl commented 2 years ago

Coming soon in Chrome: https://groups.google.com/a/chromium.org/g/blink-dev/c/kDfj3rcA6sc

Pomax commented 2 years ago

Note that COLR/CPAL is not new to OpenType, and has been part of the spec for quite some time now (having been added way back in 2015, the same time CBDT/CBLC was added). Fontkit should be able to work with it just fine, it's OT-SVG it has problems with (and given that the project is basically abandoned, will unlike ever support it).

(See https://github.com/foliojs/fontkit/issues/260 for a previous discussion around color fonts focussed on the OT-SVG format)

Pomax commented 2 years ago

@gojko can you show some (minimally viable) code that you're using right now in either your initial comment or as a reply? It shouldn't be too much work to see where things are going wrong.

gojko commented 2 years ago

@pomax I abandoned this as there was no reply from anyone for months. I added the original comment more than two years ago, so it's not something I'm interested in any more, sorry.

Pomax commented 2 years ago

Yeah, fair enough.