%D \module
%D   [       file=type-imp-erewhon,
%D        version=2022.30.09, % a bit older
%D          title=\CONTEXT\ Typescript Macros,
%D       subtitle=\TEX Gyre Fonts,
%D         author=Mikael Sundqvist,
%D           date=\currentdate,
%D      copyright={\CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%\loadtypescriptfile[texgyre]
%\resetfontfallback [erewhon-euler-fix]
%\definefontfallback[erewhon-euler-fix][texgyrepagella-math] [0x022EE,0x022F0,0x022F1,0x02661,0x02220][force=yes]

\starttypescriptcollection[erewhon]

   % \setupmathradical[\c!leftmargin=.1mq,\c!mindepth=0.1mx]%

    \pushglobalsetups
        \startsetups[\s!math:erewhon]
            \setmathradicalparameter\c!leftmargin{.1mq}%
            \setmathradicalparameter\c!mindepth  {.1mx}%
        \stopsetups
    \popglobalsetups

    %\definefontfeature[default-slanted-erewhon][default][slant=.2]
    %\definefontfeature[none-slanted-erewhon]   [none]   [slant=.2]

    \doifunknownfontfeature {erewhon-math-bold} {\definefontfeature[erewhon-math-bold][boldened]}

    \starttypescript [\s!serif] [erewhon]
        \definefontsynonym [\s!Serif]           [\s!file:Erewhon-Regular]       [\s!features=\s!default,\s!goodies=erewhon-text]
        \definefontsynonym [\s!SerifItalic]     [\s!file:Erewhon-Italic]        [\s!features=\s!default,\s!goodies=erewhon-text]
        \definefontsynonym [\s!SerifSlanted]    [\s!file:Erewhon-RegularSlanted][\s!features=\s!default]
        \definefontsynonym [\s!SerifBold]       [\s!file:Erewhon-Bold]          [\s!features=\s!default,\s!goodies=erewhon-text]
        \definefontsynonym [\s!SerifBoldItalic] [\s!file:Erewhon-BoldItalic]    [\s!features=\s!default,\s!goodies=erewhon-text]
        \definefontsynonym [\s!SerifBoldSlanted][\s!file:Erewhon-BoldSlanted]   [\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!sans] [cabin-sans]
        \setups[\s!font:\s!fallback:\s!sans]
        \definefontsynonym [\s!Sans]          [\s!file:Cabin-Regular]       [\s!features=\s!default]
        \definefontsynonym [\s!SansItalic]    [\s!file:Cabin-Italic]        [\s!features=\s!default]
        \definefontsynonym [\s!SansBold]      [\s!file:Cabin-SemiBold]      [\s!features=\s!default]
        \definefontsynonym [\s!SansBoldItalic][\s!file:Cabin-SemiBoldItalic][\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!mono] [inconsolata-mono]
        \setups[\s!font:\s!fallback:\s!mono]
        \definefontsynonym [\s!Mono]    [\s!file:Inconsolatazi4-Regular][\s!features=\s!none]
        \definefontsynonym [\s!MonoBold][\s!file:Inconsolatazi4-Bold]   [\s!features=\s!none]
    \stoptypescript

    \starttypescript [\s!math] [erewhon,erewhon-nt]
        \checkedmapfontsize[\typescripttwo][\s!script]      [.70]
        \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55]
    \stoptypescript

    \starttypescript [\s!math] [erewhon] [\s!name]
        \definefontsynonym [\s!MathRoman]    [\s!file:Erewhon-Math.otf][\s!features={\s!math\mathsizesuffix,erewhon:mathextra,mathextra},\s!goodies=erewhon-math]
        \definefontsynonym [\s!MathRomanBold][\s!file:Erewhon-Math.otf][\s!features={\s!math\mathsizesuffix,erewhon-math-bold,erewhon:mathextra,mathextra},\s!goodies=erewhon-math]
    \stoptypescript

    \starttypescript [\s!math] [erewhon-nt] [\s!name]
        \definefontsynonym [\s!MathRoman]    [\s!file:Erewhon-Math.otf][\s!features={\s!math\mathsizesuffix,erewhon:mathextra,mathextra}]
        \definefontsynonym [\s!MathRomanBold][\s!file:Erewhon-Math.otf][\s!features={\s!math\mathsizesuffix,erewhon-math-bold,erewhon:mathextra,mathextra}]
    \stoptypescript

    \starttypescript [erewhon,erewhon-nt]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [erewhon]        [\s!default]
        \definetypeface [\typescriptone] [\s!ss] [\s!sans]  [cabin]          [\s!default]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [inconsolata]    [\s!default] [\s!rscale=1.1]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [\typescriptone] [\s!default]
        \quittypescriptscanning
    \stoptypescript

\stoptypescriptcollection
