I have auto-generated input with mixed language data (don't ask) that I need to typeset. Thankfully there will be no more than two languages at a time and I will know what the two languages will be, but sadly I will not be able to tag the content with proper markup to delineate the language inside strings. For example I might have a string:

creation آفرینش

All the documentation I can find for font fallbacks has to do with setting what happens when a font face is missing. For example if I setup a custom font family for a font that doesn't have a bold variant I can set it to use the italic instead, or if it doesn't have a mono-spaced variant in the family one can fallback to a default or other font family entirely.

What I can't figure out is how to fall through from one font to another when the font is missing a glyph. For the example above I am typesetting with the Noto family of fonts and I would like to have Noto Naskh Arabic as the default font, but when it hits Latin characters that don't exist in the Arabic font I would like it to use Noto Sans instead?

How can such a glyph fallback pattern be coded?


Difficult to tell since you don't provide a minimal example so we have no idea which mechanism you are using to set your font. If you are using the new font selection scheme, there is the possibility to have a fallback defined for certain ranges, such as:

\definefallbackfamily [myfont] [serif] [Gentium] [range=greekandcoptic]

\definefontfamily [myfont] [serif] [Tex Gyre Termes]

This would typeset normal Latin characters in TeXGyreTermes and Greek in Gentium. You can combine ranges (such as latinextended, basiclatin) into a set; have a look at the file font-sel.mkvi in your context tree to show you how this works.

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.