diff options
| author | lawcho <[email protected]> | 2023-11-18 00:10:05 +0100 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-01-19 17:41:27 -0800 |
| commit | 0110f5905325e7c0420ee706413feab162493dad (patch) | |
| tree | 2ae8b3b153869767480d878c2f284f8c59ad064a /data | |
| parent | df1944f7740599896f0e3d3de1be2e6aafb62d6c (diff) | |
LaTeX template: support font fallback
* LuaLaTeX-specific (uses luaotfload)
* Configured in YAML metadata
* Sans/main/mono fonts have separate fallback chains
Diffstat (limited to 'data')
| -rw-r--r-- | data/templates/default.latex | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/data/templates/default.latex b/data/templates/default.latex index 6d062af19..72b22896c 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -139,13 +139,37 @@ $endif$ \ifPDFTeX\else % xetex/luatex font selection $if(mainfont)$ - \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} + $if(mainfontfallback)$ + \ifLuaTeX + \usepackage{luaotfload} + \directlua{luaotfload.add_fallback("mainfontfallback",{ + $for(mainfontfallback)$"$mainfontfallback$"$sep$,$endfor$ + })} + \fi + $endif$ + \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$} $endif$ $if(sansfont)$ - \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} + $if(sansfontfallback)$ + \ifLuaTeX + \usepackage{luaotfload} + \directlua{luaotfload.add_fallback("sansfontfallback",{ + $for(sansfontfallback)$"$sansfontfallback$"$sep$,$endfor$ + })} + \fi + $endif$ + \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$$if(sansfontfallback)$,RawFeature={fallback=sansfontfallback}$endif$]{$sansfont$} $endif$ $if(monofont)$ - \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$} + $if(monofontfallback)$ + \ifLuaTeX + \usepackage{luaotfload} + \directlua{luaotfload.add_fallback("monofontfallback",{ + $for(monofontfallback)$"$monofontfallback$"$sep$,$endfor$ + })} + \fi + $endif$ + \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$if(monofontfallback)$,RawFeature={fallback=monofontfallback}$endif$]{$monofont$} $endif$ $for(fontfamilies)$ \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$} |
