In case a font doesn't have some symbols, is there an easy way to just fall back to whatever font LuaTeX can find that supports that glyph, just for that symbol?

Or is there a reasonably complete serif font? The default one doesn't even seem to have ○ (white circle) or α (alpha). I tried a few, but most fonts that show up in mtxrun --script fonts --list --all --pattern=* and even defaults like cmr (Computer Modern Roman) and lbr (Lucida Bright) don't seem to be loaded somehow (times and palatino work though with \setupbodyfont[palatino]).

I also get the following warnings when compiling:

fonts           > typescripts > unknown library 'cmr'
fonts           > preloading latin modern fonts (third stage)

I'm on Mac OS X 10.8.4 with context version 2013.04.20 01:15.

  • Please post a minimal example.
    – Aditya
    Jul 21 '13 at 0:23

You can define so called font fallbacks. This is a mechanism to map a selection of unicode points to another font. Either a range can be specified using colons (0x0400:0x04ff) or single glyphs separated by commas, or both together. Add [force=no] to only replace the characters when they are missing.

However, you have to define which font to use as a fallback. LuaTeX will not make an arbitrary choice. Fonts have to be picked carefully and font matching is, even for a human, not an easy task. No automatic system can find matching fonts.

Here is an example of how to create a font fallback for the two glyphs you mentioned. The Xits and Latin Modern do not match at all, it's just for illustration of the mechanism.

  [name:xitsregular] [0x03B1,0x25CB] %% [force=no]



  The default one doesn't even seem to have ○ (white circle) or α (alpha).


The better way is to find a font which contains all characters you need. Which font you can consider “reasonably complete“ totally depends on your needs. If a particular font covers all the glyphs you can check using the method described in this answer: Create a font table for all available characters for a particular font. The DejaVu might cover your needs:

\setupbodyfont [dejavu]

  The default one doesn't even seem to have ○ (white circle) or α (alpha).

It might as well be helpful to enable tracking missing fonts:

\enabletrackers [fonts.missing]

Then ConTeXt notifies you about missing glyphs and you get an entry in the log file:

fonts  > checking > char ○ (U+025CB) in font 'LMRoman12-Regular' with id 1: missing
fonts  > checking > char α (U+003B1) in font 'LMRoman12-Regular' with id 1: missing
  • Thanks, this already helps a lot. Can you tell me why \setupbodyfont[minionproregular] gives fonts > typescripts > unknown library 'minionproregular' (same with name:minionproregular) but \ShowCompleteFont{name:minionproregular}{10pt}{1} works?
    – mb21
    Jul 21 '13 at 8:44
  • 2
    name:somefont addresses only a single font. The argument for \setupbodyfont on the other hand requires a typescript with font definitions for the individual font styles (regular, sans, etc. and bold, italic, bolditalic, etc.). Either you need to create a typescript or you use the simplefonts module.
    – Marco
    Jul 21 '13 at 9:15

Basically, you should use a font that supports the characters you need. Also, make sure you really have the right unicode char (like the mathematical alpha, not the greek one or the more common white circle ◦).

But if you don't mind a hack (slows down compilation also), you can simply define a fallback font for all missing glyphs with the simplefonts module:

\setmainfontfallback[DejaVu Serif][range={0x00000-0xFFFFFF}, force=no, rscale=auto]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.