Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes:

>> I've attached an example .tex (lualatex) file, with bits and pieces from
>> many discussions at tex.stackexchange and elsewhere.
>> The structure would allow us to create two custom variables to generate
>> the code:
>>
>> one for the direct lua fallback list and another for the \set...font
>> mappings
>>
>> I think that trying to address all mappings out-of-the-box is not very
>> realistic and would add too much noise.
>> This option can be (easily?) tailored to everybody's needs, without
>> imposing too much burden on anybody.

> \documentclass{article}
> \usepackage{fontspec}
> \usepackage{amsmath}
> \usepackage{unicode-math}
>
> \directlua{
>    luaotfload.add_fallback("FallbackFonts", { 
>       "Noto Color Emoji:mode=harf", 
>       "Noto Sans CJK JP:" 
>    })
> }
>
> \setmathfont{Stix Two Math}[RawFeature={fallback=FallbackFonts}]
> \setromanfont{FreeSerif}[RawFeature={fallback=FallbackFonts}]
> \setsansfont{FreeSans}[RawFeature={fallback=FallbackFonts}]
> \setmonofont{FreeMono}[RawFeature={fallback=FallbackFonts}]
> % for \textrm{} to work, we can't \setmainfont
> % \setmainfont{FreeSans}[RawFeature={fallback=FallbackFonts}]
> % We need to put this in the #+LATEX_HEADER instead
> \renewcommand{\familydefault}{\sfdefault}

During the last Orgmeetup, there was suggestion to check out how
pandoc handles the problem.
They do it very similarly - allow customization for fallback fonts for
main font, sans font, and mono font.
See 
https://pandoc.org/MANUAL.html#fonts:~:text=mainfontfallback%2C%20sansfontfallback,with%20lualatex
and 
https://github.com/jgm/pandoc/blob/ec08f03782371b036416fbf4eede3002e000fff5/data/templates/font-settings.latex#L8

*They also provide babelfonts, CJK fonts, and math fonts*.
https://github.com/jgm/pandoc/blob/ec08f03782371b036416fbf4eede3002e000fff5/data/templates/font-settings.latex
https://github.com/jgm/pandoc/blob/ec08f03782371b036416fbf4eede3002e000fff5/data/templates/common.latex#L194

That's something worth considering.

Also, check out 
https://github.com/jgm/pandoc/blob/ec08f03782371b036416fbf4eede3002e000fff5/data/templates/fonts.latex

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