Max Nikulin <maniku...@gmail.com> writes:

>> \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.

I think that our first priority should be getting fallbacks
working. Trying to optimize it is going too far ahead.

> 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.

Yup, that's what I thought. It looks like lualatex is able to scan
available fonts and select first available, so we do not have to limit
ourselves to a single font.

> 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.

+1

>> % ===== 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

Would you mind consolidating example lualatex document that will
compile? LLM example is not very useful (it does not compile) - it only
illustrates that automatic font fallbacks are possible. Your example
from the linked thread also does not compile.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to