On 12/04/2025 21:28, Ihor Radchenko wrote:
% ===== UNIVERSAL FALLBACK STACK =====
% (Only activates when default font lacks glyphs)
\directlua{
luaotfload.add_fallback("global_fallback", {
"Noto Serif:mode=harf;", % 1st: Broad Unicode coverage
"DejaVu Serif:mode=harf;", % 2nd: Common Linux/Windows font
"FreeSerif:mode=harf;", % 3rd: Common TeX Live font
"Arial Unicode MS:mode=harf;", % 4th: Windows fallback
"Code2000:mode=harf;" % 5th: Historic Unicode font
})
}
Has anybody tested that LuaTeX can efficiently cache that some
characters are missed in earlier tried fonts? It looks like a rather low
level feature, so without benchmarks I am unsure if it is reasonably
optimized.
This list looks like a set of fallback variants for primary font, not as
options to try when some characters are missed. Perhaps it may be
reasonable to have predefined configuration for widely used fonts like
Noto, freefonts, DejaVu, Liberation, CMU (Computer Modern Unicode),
crosscore, ubuntu, etc., test what ones are installed (unless preferred
family is configured by the user) and use just it.
The key point is to have a number of presets for complete set of fonts
(serif, sans, mono, math) instead of simple alist. It would be
unfortunate to render document with Noto Sans and FreeSerif just because
Noto Serif is not installed.
% ===== SCRIPT-SPECIFIC FALLBACKS =====
% (Only activate for specific scripts)
\newfontfamily\cjkfallback{Noto Sans CJK SC}[Script=Han]
\newfontfamily\arabicfallback{Amiri}[Script=Arabic]
\newfontfamily\symbolfallback{Segoe UI Symbol}[
Scale=MatchLowercase,
RawFeature={colr=yes} % For emoji support
]
[...]
CJK: {\cjkfallback 汉语 日本語} \\
I recall Juan Manuel posted examples with per-script font configuration
for babel. The problem was babel language detection based on character
script vs. explicit foreignlanguage commands.
My experiments with hieroglyphs and emoji:
For my earlier experiments with configuring fonts for LuaLaTeX see
Maxim Nikulin. Re: org-mode export to (latex) PDF. Sat, 17 Jul 2021
19:35:57 +0700.
https://list.orgmode.org/scuirf$m7o$1...@ciao.gmane.io