Background
Using LMTX to typeset an XML document that has been converted from Markdown. Users may type emojis directly into the document without using TeX macros.
Problem
The emojis don't appear when defined as a fallback font. One of the linked answers notes:
You don't want to use the Emoji font as fallback.
It may be that what I'm trying to do won't work.
Code
The following document shows how the fallback is used:
\enabletrackers [fonts.missing]
\definefallbackfamily
[FontBody] [serif] [Noto Emoji] [range={miscellaneoussymbols,dingbats}]
\definefontfamily
[FontBody] [serif] [Noto Serif]
\setupbodyfont[FontBody]
\starttext
Emoji:
π¨πΎπ¨π³π¨ππ¨π€π¨π¨π¨π«π¨ππ¨π»π¨πΌπ¨π§π¨π¬π¨π
ππππ»π¨π©
\stoptext
Neither MuPDF nor Evince show the emojis. Deleting the ~/luametatex-cache/
directory doesn't help. Using the font directly sort of works:
\enabletrackers [fonts.missing]
\definefontfamily
[FontBody] [serif] [Noto Emoji]
\setupbodyfont[FontBody]
\starttext
Emoji:
π¨πΎπ¨π³π¨ππ¨π€π¨π¨π¨π«π¨ππ¨π»π¨πΌπ¨π§π¨π¬π¨π
ππππ»π¨π©
\stoptext
This produces the glyphs, but no longer shows any text, page header notwithstanding:
Errors
When trying to use the fallback, ConTeXt outputs the following errors:
fonts > 'fallback modern-designsize mm 12pt' is loaded
fonts > preloading modern-designsize (mono)
fonts > 'fallback modern-designsize tt 12pt' is loaded
fonts > checking > char π¨ (U+1F468) in font 'LMRoman10-Regular' with id 1: missing
Not sure why it's trying to find the glyphs in LMRoman10-Regular
when the code was defining the fallback as Noto Emoji. Using an explicit range also didn't work:
\definefallbackfamily
[FontBody] [serif] [Noto Emoji] [range={0x1F400-0x1F600}]
It is possible to use \definefont[EmojiFont]
and a variation upon:
\starttext
Emoji: \EmojiFont{π¨}
\stoptext
However, that would mean introducing TeX markup into the Markdown source document, which I'd like to avoid.
Question
Without modifying the document body (i.e., no changes between \starttext
and \stoptext
), how do you get the emojis and text to appear in the PDF at the same time?
Related
Similar questions:
- Setting fallback font in ConTeXt
- ConTeXt unicode fallback font
- ConTeXt: Using Emoji Fonts without Color
- How to activate font fallbacks on typefaces in ConTeXt?
Addendum
The main ConTeXt font setup I'm using resembles:
% Greek letters aren't defined by Baskerville, first try Source Serif Pro.
% Source Serif Pro pairs well with Libre Baskerville in terms of font weight
% and rounded accents.
\definefallbackfamily [TextFont] [serif] [Source Serif Pro] [
range=greekandcoptic,
rscale=1.17
]
\definefontfamily [TextFont] [rm] [LibreBaskerville] [features=TextFontFeature]
\definefontfamily [TextFont] [ss] [Archivo Narrow]
\definefontfamily [TextFont] [tt] [Inconsolata]
\definefontfamily [TextFont] [mm] [TeX Gyre Pagella Math]
\setupbodyfont[TextFont]
This works flawlessly to put Greek letters into the document. I thought that emojis would be similar.