Command/definefontfallback

From Wiki
Jump to navigation Jump to search


\definefontfallback

Summary

The command \definefontfallback is used to setup fonts for missing characters in the main font.

Settings

\definefontfallback[...][...][...,...][...=...,...]
[...]name
[...]font name
[...,...]name number
rscalenumber
forceyes no
checkyes no
offsetnumber name
targetnumber name
featuresname
factornumber
methodlowercase uppercase

OptionExplanation
a typescript identifier to use with \definefontsynonym
the font to be used for the fallbacks
unicode character ranges or unicode block name(s)
options
rscale
relative scaling
force
use the replacement font, even if the main font contains the glyphs
check
check if the main font contains the glyphs (adds some lag)
features
activate font features

Description

This command allows to define fallback fonts for certain glyphs which are not found in the main font. The command takes four arguments where the last one is optional. The third argument (Unicode ranges) may be either a comma separated list of slots, or a a range with the syntax code|1=slot-slot or one of the mnemonic names from the following table.

See Unicode blocks in ConTeXt and List of Unicode blocks.

Examples

Moustache brackets

We load the moustache brackets from XITS Math because they are not available in Latin Modern Math, which is the default math font. Of course, the technique also works for text fonts (but not in this page).

\definefontfallback [xits-fallback] [file:xits-math.otf] [023B0,023B1]

\definefontsynonym  [MathRoman]     [modern]             [fallbacks=xits-fallback]

Consider this increasing sequence of moustached primes:

\startformula
  \lmoustache 11 \rmoustache <

  \lmoustache 29 \rmoustache <

  \lmoustache 31 \rmoustache <

  \lmoustache 37 \rmoustache <

  \lmoustache 41 \rmoustache
\stopformula

Emojis

Our main fonts doesn’t contain emojis, so we want to take them from a specialized font. And since emojis are spread over several Unicode blocks, we just say “take every unknown glyph from that emoji font” (which doesn’t work for all symbols, of course).

\definefontfallback[emojifallback]
[name:EmojiOneColor][0x00000-0xFFFFF][check=yes,force=no]

\definefontsynonym [Serif] [Pagella]  [features=default,fallbacks=emojifallback]

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: