I would like to setup document which use by default EB Garamond font and for specific not recognized characters auto switch to fallback fonts. I found that it is possible by using luaotfload
fallback. It works well on simple text like \myfont العَرَبِ
. But I would like to use it globally on entire document and it does not work. As you can see in the example I am using \begin{myfont}
and \end{myfont}
to apply globally. But that is probably not right solution. I am using standard inner commands like \begin{flushleft}
\Large{العَرَبِ}
and that is probably the problem. Could you help me how to setup myfont
globally?
\documentclass[oneside, 11pt]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\directlua
{luaotfload.add_fallback
("myfallback",
{
"DejaVuSans:mode=harf;script=grek;color=FF0000;",
"cmuserif:mode=node;script=cyrl;color=00FF00;",
"NotoSansBengali:mode=harf;script=bng2;color=0000FF;",
"NotoColorEmoji:mode=harf;"
}
)
}
\font \myfont ={name:EBGaramond:mode=node;fallback=myfallback;}
\begin{document}
\begin{myfont}
Příliš žluťoučký kůň úpěl ďábelské ódy
\Large{Velký ביץ aaa}\small{Malý aaa טון}
العَرَبِيَّة
\Huge العَرَبِيَّة
𝑰
aaaטון ביץaaa
😀😝😝😄☺️😀♥️🤝✌️🤷🏻♂️🐌😍😘🙆🏻♂️🤯
Αν προ δετραcτο vερτερεμ, σιμιλιqθε μοδερατιθσ θτ vελ. Νθμqθαμ μινιμθμ cομπρεηενσαμ μει ει, σιτ προβο νοστρθδ οπορτερε εθ. Αγαμ ρεπριμιqθε τε ηισ, ιδ σιτ μαγνα προμπτα ινvενιρε, qθο ιν θνθμ οφφενδιτ οπορτεατ. Ιπσθμ vελιτ πρινcιπεσ αδ σεα, εξ προ διcτασ λαβιτθρ. Εθμ ετ vιρισ δελιcατισσιμι.
\end{myfont}
\end{document}
Best Answer
Add the fallback as a feature to your main font