Open callegar opened 3 years ago
luaotfload
has a experimental feature for this since 3.12 but it does not seem to be implemented in fontspec.
Yeah, found a solution :partying_face:
\directlua
{luaotfload.add_fallback
("myfallback",
{
"DejaVuSans:mode=harf;script=grek;color=FF0000;",
}
)
}
\newfontfamily\Sen[AutoFakeSlant,NFSSFamily=Sen,RawFeature={fallback=myfallback}]{Sen}
\renewcommand{\sfdefault}{Sen}
See the documentation of the luaotfload
-package for more options. You can even provide a chain of font with emoji-fonts and things like that.
Description
Please introduce a way to support virtual fonts in luatex
Check/indicate
Minimal example demonstrating the issue
Not relevant
Further details
One of the missing items moving from regular (pdf)latex to modern engines is the lack of virtual fonts when using unicode fonts. Even if for unicode fonts it is possible to support multiple languages, and different text features only a very limited number of fonts go beyond latin alphabets or provide things like small caps. Lack of virtual fonts means that if one needs to typeset a piece of text including characters that are not available in the font (e.g. a few Greek words or letters), then he/she is left with a few of alternatives that are not completely satisfactory:
Items 2 and 3 are ugly and break the readability of the text in the original document. Particularly 3 looks like going back to the legacy TeX accenting or
\textcomp
Furthermore, they make it impossible to directly cut and paste unicode text into the latex source, which should be one advantage of using a modern engine. Item 1 on the other hand introduces a nasty restriction.The other way round, one would really appreciate having an interface that lets one select a main font and then, if in rendering the document some glyphs are missing or ugly, easily provide a fallback or an alternative for some glyph sets. Examples:
or
This kind of functionality can currently be obtained in
LuaTeX
using thecombofont
package. However, the latter is not only marked as experimental and unstable, but also rather low level in its interface and not very consistent with the way in which fontspec lets things be configured. Specifically, it is not really very nice for quickly experimenting different fallbacks or alternatives.I realize that there can be some resistance in supporting in fontspec something that needs to be done in very different ways in LuaTex and XeTeX (I have seen you answer to bug 225 that has been closed long ago). However, I wonder if anything might have been changed since 2016 (the original date when that was reported). Furthermore, I have a feeling that until fontspec starts supporting a virtual font mechanism at least at an experimental level, there will be no chance that: (i) XeTeX and LuaTeX can converge on ways of doing it; and (ii) related bugs in the LuaTeX font loader are fully unveiled and fixed. Hence, I truly hope that this can be taken in consideration.