I am trying to use some fonts installed on my computer with typescript as explained in this post in order to create some fancy titles but I have a strange issue with \setuphead.
Here is an example with \switchtobodyfont in \setuphead's style:
\starttypescriptcollection [fira]
\starttypescript [sans] [fira]
\setups[font:fallback:sans]
\definefontsynonym [Sans] [file:FiraSans-Regular.otf] [features=default]
\definefontsynonym [SansItalic] [file:FiraSans-RegularItalic.otf] [features=default]
\definefontsynonym [SansBold] [file:FiraSans-Bold.otf] [features=default]
\definefontsynonym [SansBoldItalic] [file:FiraSans-BoldItalic.otf] [features=default]
\definefontsynonym [SansCaps] [file:FiraSans-Regular.otf] [features={default,smallcaps}]
\stoptypescript
\starttypescript [mono] [fira]
\setups[font:fallback:mono]
\definefontsynonym [Mono] [file:FiraMono-Medium.otf] [features=default]
\definefontsynonym [MonoBold] [file:FiraMono-Bold.otf] [features=default]
\stoptypescript
\starttypescript [math] [fira]
\definefontsynonym [MathRoman] [file:Fira-Math.otf] [features=mathextra]
\stoptypescript
\starttypescript [fira]
\definetypeface [\typescriptone] [rm] [serif] [modern] [default]
\definetypeface [\typescriptone] [ss] [sans] [fira] [default]
\definetypeface [\typescriptone] [tt] [mono] [fira] [default]
\definetypeface [\typescriptone] [mm] [math] [fira] [default]
\quittypescriptscanning
\stoptypescript
\stoptypescriptcollection
\setuphead[section][style={\switchtobodyfont[fira,sans]}]
\starttext
\section{section 1}
\section{section 2}
\section{section 3}
\stoptext
What do happens here?


\definefontsynonymsettings add spaces when you load the font for the first time, to avoid this you can move the typescript settings in a separate file (e,g.type-fira.tex) which is loaded\switchtobodyfontor you preload the typescript with\usetypescript[fira].