how to reset and switch fallbackfont?

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 %%%% best wishes, autumnus

Am 28.02.2025 um 13:21 schrieb autumnus:
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?
My guess (but I can be wrong here) is that these settings a fixed once you load a font with a fallback applied. While creating separate typescripts for each fallback font means additional work, there are ways to avoid duplicate settings dependent on your requirements. Do you need access to the main font with different fallbacks in the same document or is the purpose of the alternative font to ensure you get the correct output even when one font is missing on the system? Wolfgang

I want to set different fallbackfonts for the main font in the same document. I think your guess is correct. Once the fallbacks is set, the mainfont will be bound to the font. Even if I switch to other typescripts, as long as its style(rm,ss etc) does not change, it will still use the previous fallbackfont.

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 -----------------------------------------------------------------
participants (3)
-
autumnus
-
Hans Hagen
-
Wolfgang Schuster