fontspec
fontspec copied to clipboard
Provide a way of defining fallback fonts for missing characters
Referring to How can I specify a chain of fallback fonts in XeLaTeX? and several similar questions on tex.sx (and in other places), there seem to be a need (or at least desire) for a way of providing fallback fonts for missing characters.
Of course there are workarounds, the most common being manually switching fonts for these characters, possibly via wrapping the characters using \newunicodechar
, but this is quite cumbersome, and doesn't help when you don't know in advance when you will need to switch fonts. Such a case would be e.g. a bibliography entry in Latin characters, but with a location in another script (e.g. Αθήνα, Ελλάδα).
A nicer workaround is to assign different fonts to different character ranges, using either ad-hoc packages, such as xeCJK
, or ucharmap
but those are only available for XeLaTeX and even so, it would feel more natural to have it included in fontspec, as e.g. unicode-math
does with the range
option.
This isn’t possible for XeTeX in a “clean” way, but it is possible with luaotfload. I’ll leave this issue open as a reminder for me to take a look again at luaotfload’s interface and see whether anything sensible could work in fontspec as a wrapper to that.
@wspr Regarding the fall back for luaotfload: There is an example of use in the combofont package. And if you look at it, please contact me, as I'm interested in a cleaner interface to use combofonts with fontspec and unicode-math (the last one is actually the more problematic).
@u-fischer Thanks Ulrike, I'll see what I can come up with (if anything!)... might not be straight away I'm afraid. I really need to get a revision of unicode-math out at some point though.
There is a group of people who use rmarkdown to create html output and pdf output (e.g with xelatex). Html does fallback fonts work very neatly, but the same code doesn't seem to be accepted by the pdf toolchain (fontspec ?). Here's a link to the problem from an rmarkdown perspective. /rmarkdown-fallback-fonts-not-working-consistently-across-output-to-pdf-and-html
See also #428