Hi, hope everyone's doing well!

Is it possible to setup math font so that all the basic ascii characters (i.e. 
a..zA..Z0..9) glyphs are substituted with current serif (or sans) font. I tried 
playing with fallback thing but it didn't got me anywhere!

e.g. $x$ will use the 'x' glyph from current serif italic font, and $\bf x$ 
will use the 'x' glyph from current serif bold font!
I would appreciate any suggestions and help!

Suppose we have all the required font files in the 'font' directory of the 
working directory, and below is the minimal source code! 
"""
\starttypescriptcollection[CustomFontSelection]
  \starttypescript [serif] [CustomFontSelection] [name]
    \setups[font:fallback:serif]
    \definefontsynonym [Serif]
        % [file:font/Lora-Regular.ttf]
        [file:font/Lora-Medium.ttf]
        [features=default,fallbacks=Serif]
    \definefontsynonym [SerifBold]
        [file:font/Lora-Bold.ttf]
        [features=default,fallbacks=SerifBold]
    \definefontsynonym [SerifItalic]
        % [file:font/Lora-Italic.ttf]
        [file:font/Lora-MediumItalic.ttf]
        [features=default,fallbacks=SerifItalic]
    \definefontsynonym [SerifBoldItalic]
        [file:font/Lora-BoldItalic.ttf]
        [features=default,fallbacks=SerifBoldItalic]
  \stoptypescript

  \starttypescript [math] [CustomFontSelection] [name]
    %%% \definefontfallback [MathRomanFallBack]
    %%%     [SansItalic]
    %%%     [extendedlatin]
    %%%     [force=yes] 
    \definefontsynonym [MathRoman]
        [file:font/STIXTwoMath-Regular.otf]
        [features=math,fallbacks=MathRomanFallBack] 
  \stoptypescript

  \starttypescript[CustomFontSelection]
    \definetypeface [CustomFontSelection] [rm] [serif] [CustomFontSelection]    
[default] [rscale=0.9]
    \definetypeface [CustomFontSelection] [ss] [sans]  [newcomputermodern-book] 
[default]
    \definetypeface [CustomFontSelection] [tt] [mono]  [newcomputermodern-book] 
[default]
    \definetypeface [CustomFontSelection] [mm] [math]  [CustomFontSelection]    
[default] [rscale=0.97] 
  \stoptypescript  
\stoptypescriptcollection

\setupbodyfont[CustomFontSelection] 


\starttext

We use $X$, $Y$, $Z$ and $n$, $m$, etc. $\sin(x) \to \limsup x_n$ whatever.

\mathematics{%
  \delta_{ij} =
    \startmathcases
    \NC 1 \NC \text{if } i = j \NR
    \NC 0 \NC \text{otherwise} \NR
    \stopmathcases
}

We use $\bf X$, $\bf Y$, $\bf Z$ and $\bf n$, $\bf m$, etc. $\bf \sin(x) \gets 
\limsup x_n$ whatever.

\stoptext
"""

Best regards,
Ali
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to