
On 2/28/2025 1:21 PM, autumnus wrote:
hi,
As described in the title, how to reset fallbackfont?
I have created a number of Chinese typescripts and related fallbackfont (latin).
However, in the actual operation process, I found that if you want to switch different fallbackfont, you must change the bodyfont at the same time (\setupbodyfont).
The following is an example. How should I reset and switch to fallbackfont without changing the bodyfont?
%%%%%%%
\definefontfeature[zh][mode=node,script=hang,lang=zhs]
\startsetups fallbacks:reset \resetfontfallback[serifwhatever] \resetfontfallback[serifboldwhatever] \resetfontfallback[serifitalicwhatever] \resetfontfallback[serifbolditalicwhatever] \stopsetups
\startsetups fallback:lm \definefontfallback[serifwhatever] [lmroman10-regular] [0x0000-0x0400][force=yes] \definefontfallback[serifboldwhatever] [lmroman10-bold] [0x0000-0x0400][force=yes] \definefontfallback[serifitalicwhatever] [lmroman10-italic] [0x0000-0x0400][force=yes] \definefontfallback[serifbolditalicwhatever][lmroman10-bolditalic][0x0000-0x0400][force=yes] \stopsetups
\startsetups fallback:eb \definefontfallback[serifwhatever] [ebgaramondregular] [0x0000-0x0400][force=yes] \definefontfallback[serifboldwhatever] [ebgaramondbold] [0x0000-0x0400][force=yes] \definefontfallback[serifitalicwhatever] [ebgaramonditalic] [0x0000-0x0400][force=yes] \definefontfallback[serifbolditalicwhatever][ebgaramondbolditalic][0x0000-0x0400][force=yes] \stopsetups
\starttypescript [serif] [zhfont] \definefontsynonym [Serif] [AdobeSongStd-Light] [features=zh,fallbacks=serifwhatever] \definefontsynonym [SerifBold] [AdobeHeitiStd-Regular][features=zh,fallbacks=serifboldwhatever] \definefontsynonym [SerifItalic] [AdobeKaitiStd-Regular][features=zh,fallbacks=serifitalicwhatever] \definefontsynonym [SerifBoldItalic][AdobeHeitiStd-Regular][features=zh,fallbacks=serifbolditalicwhatever] \stoptypescript
\starttypescript[myfont] \definetypeface[myfont][rm][serif][zhfont] \stoptypescript
\usetypescript[myfont] \starttext
\setups{fallback:lm} \setupbodyfont[myfont,rm,12pt] fonts {\bf fonts} {\bi fonts} {\it fonts} % will be lm font \\\the\font
\setups{fallbacks:reset} \setups{fallback:eb} fonts {\bf fonts} {\bi fonts} {\it fonts} % expected eb but lm \\\the\font
\setups{fallbacks:reset} \setups{fallback:eb} \setupbodyfont[myfont,rm,12pt]%% any other chinese font, and change to eb fonts {\bf fonts} {\bi fonts} {\it fonts} \\\the\font \stoptext %%%%
What is the (realistic) use case for that. Normally you set up a main bodyfont and then that one has fallbacks bound to it. Maybe another one with likely different fallbacks. Changing fallback fonts 'in the middle of anything' will introduce confusion, give clashes, add more code, with basically zero gain. There are sitations where it's kind of fun to show if something can be done, but this is not one of them. As Wolfgang answered: it's no big deal to define an extra fontclass. If the sole purpose is to be able to show something in a mnaual or so, one can use a subrun and include pages from that. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------