Colored emojis
How to retrieve a colored emoji from a font?
We have Loader::outline, but for emojis we have to return an SVG? I have no idea how this is implemented in existing software...
This is going to depend a lot on the platform. On Windows, you get colored outline layers from the COLR table. On macOS and Android, it's essentially bitmap PNG's embedded into the font. The OpenType standard also has a provision for svg but I don't think it's widely used (ie I don't think any platform provides it).
I think the best general approach is to use the bitmap rasterize loader interface with an RGBA format. Then there's potential fine-tuning to do to match the platform's representation more closely, but this should be a reasonable start.
See this helpful page on color fonts from FontLab for more information about the differences between platforms in color font handling.
Is there a way to check what format is used in a font? I've tried FontForge, but it could not open NotoColorEmoji.ttf.
Anyway, in my case, SVG is enough. Bitmap one will make stuff too complicated. Moreover, I'm not sure if font-kit supports bitmap fonts at all.
FontTools’ ttx can list font tables or dump them to XML representation. In case of Noto Color Emoji, it uses bitmaps in the CDBT table.
@khaledhosny Thanks. I will try it out.
So I think there are three features we want from font-kit:
-
A method that specifies the type of a glyph outline. This can be at least an OpenType outline, a CFF2 outline, a bitmap, an SVG, or a series of outlines with a COLR table.
-
The ability to fetch the text of an SVG glyph. SVG parsing, rendering, etc. seems out of scope of
font-kit. -
The ability to enumerate outline colors, for COLR.
I don't see the need for special support for bitmaps, given that we already have a function to rasterize a glyph. In the case of a bitmap glyph, that function should already be doing a plain old image blit.
Here you can view the support status of all platforms: https://www.colorfonts.wtf/

@RazrFalcon Were you able to make something work?
@samyak-jain No.
@raphlinus Is this feature out of scope for this crate? If not, let me know if there's any way I can contribute.