Create a ttf file with emoji

2.3k Views Asked by At

I have a folder with all the .png emojis and I should compact them in a ttf file to flash it with magisk but I don't know how to create the .ttf file, how can I do?

1

There are 1 best solutions below

0
Peter Constable On

Ttfs can use color bitmaps, but (of course) they are not scalable: the bitmaps are intended for a particular size. The font can contain alternate bitmaps for different sizes; these size-specific sets of bitmaps are known as "strikes". If you have one set of .png images, that would comprise a single strike.

The OpenType font spec allows for two different table formats that can be used for colour bitmap glyphs: the 'sbix' table, and the 'CBDT' / 'CBLC' table combination. Different platforms and apps might support one, both, or neither. So, which format you use will depend on which targets you want to support. You can always create two variant fonts, one for each format; or you can also create a font that contains both 'sbix' and 'CBDT'/'CBLC' and let the app pick which it uses.

Btw, a further consideration will be whether to include B/W outlines corresponding to each colour glyph. If the target use is in a context where you know colour glyphs will always be supported, then you can get away without outlines. But for more widespread use, you might want to have B/W outlines as a fallback.

Some professional font development tools support 'sbix' and 'CBDT'/'CBLC' colour glyphs:

If you're familiar with Python and would prefer open source tools, check out fonttools.