For example, I'd like to use the Twemoji font[1]. Fedora provides a TrueType variant[2] built using Google's Noto Emoji tooling[3]. Then there is a COLR/CPAL version provided by Mozilla[4].
I can't use any of the TrueType emoji fonts built in the same manner as the Noto Emoji font. This also includes Android Emoji, EmojiOne and NotoColorEmoji. The error is:
! error: (file /usr/share/fonts/twemoji/Twemoji.ttf) (ttf): sfnt table not foundmtx-context | fatal error: return code: 1
I can't use any of the color versions, i.e. the COLR/CPAL Twemoji Mozilla. The competing font color proposals are new, but I was hoping the font would display without color (black). In fact the glyph is present and can be copied from the PDF; it is just transparent.
\definefallbackfamily [mainface] [serif] [twemoji] [range={miscellaneoussymbolsandpictographs}]
\definefontfamily [mainface] [serif] [DejaVu Serif]
\definefontfamily [mainface] [sans] [DejaVu Sans]
\definefontfamily [mainface] [mono] [DejaVu Sans Mono]
\setupbodyfont[mainface]
\definesymbol[link][\utfchar{"1F517}]
\starttext
A\symbol[link]B
\stoptext
follow-up:
As documentation there is also On and On, Chapter 4: Emoji Again which is basically a verbose version of the presentation linked in the answer and explains most of the followup questions I have:
The
\emoji
command requires the "emoji" font synonym to have been defined. I can confirm this is done by the\define*family
commands though you still have to passfeatures={colr=yes,}
or alternatively any name defined via\definefontfeature
.The standalone link emoji requires only
colr=yes
. The documentation explains (with examples) why theccmp
anddist
features should also be enabled for overlay fonts - basically, for combining emojis.For completion I describe the other emoji fonts in my question, as per
mtxrun --script fonts --list --all --pattern='*emoji*'
:google-android-emoji/AndroidEmoji.ttf
non-color (no features required)
eosrei-emojione/emojione-android.ttf
bitmap
EmojiOne/OpenType.SVG.v3.1.2/emojione-svg.otf
non-color (no features required) + svg
Notes: Either works. Although the svg feature causes ConTeXt to generate glyphs using inkscape, these glyphs are positioned exactly like the regular glyphs (as opposed to bitmap glyphs) and are drawn black and white, without color. This leads me to think that ConTeXt is not drawing the converted glyphs. This font is advertised as EmojiOne v3 though the glyphs are clearly from EmojiOne v2.
google-noto-emoji/NotoColorEmoji.ttf
bitmap
google-noto-emoji/NotoEmoji-Regular.ttf
non-color (no features required)
Twemoji.ttf
bitmap
Notes: The conversion is very ugly for this font.
I should note that the glyph positioning of bitmap (and probably svg) fonts is sub-par: the bottom of the image is aligned to the baseline. Also, the initial conversion process (bitmap->png->tma->tmc) is very slow and the end result is rasterized: it will look pixelated at high zoom levels.
Consider the signature
\definefontfeature [...] [...] [.=.]
. The first argument is clearly an arbitrary user-defined feature name that is later selected via a font name, for example,[name:twemojimozilla*default,overlay]
with either\definefont
or\definefontsynonym
. This example enables both the "default" and "overlay" features, "default" being predefined by ConTeXt as:default:liga=yes,kern=yes,tlig=yes,trep=yes
According to the documentation I should also be able to use
\definefontsynonym[emoji][name:twemojimozilla][features=overlay]
, but that doesn't work.What I don't understand is the second argument to
\definefontfeature
, i.e. the[default]
in\definefontsynonym[emoji][name:twemojimozilla*default,overlay]
. What does it do?When I try to force a greyscale palette, recreating the workflow on page 15 of the online presentation slides mentioned in the answer but substituting the
TwemojiMozilla
font forseguiemj
, I get this error:! error: (vf command): commands has to be a tablemtx-context | fatal error: return code: 1
Do you mind updating you answer with the correct approach?
Sources: