%D \module
%D   [       file=type-imp-xcharter,
%D        version=2022.30.09, % a bit older
%D          title=\CONTEXT\ Typescript Macros,
%D       subtitle=XCharter 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.

\starttypescriptcollection[xcharter]

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

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

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

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

    \starttypescript [\s!serif] [xcharter] [\s!name]
        \definefontsynonym [\s!Serif]           [\s!file:XCharter-Roman]      [\s!features=\s!default,\s!goodies=xcharter-text]
        \definefontsynonym [\s!SerifItalic]     [\s!file:XCharter-Italic]     [\s!features=\s!default,\s!goodies=xcharter-text]
        \definefontsynonym [\s!SerifSlanted]    [\s!file:XCharter-Slanted]    [\s!features=\s!default]
        \definefontsynonym [\s!SerifBold]       [\s!file:XCharter-Bold]       [\s!features=\s!default,\s!goodies=xcharter-text]
        \definefontsynonym [\s!SerifBoldItalic] [\s!file:xcharter-BoldItalic] [\s!features=\s!default,\s!goodies=xcharter-text]
        \definefontsynonym [\s!SerifBoldSlanted][\s!file:XCharter-BoldSlanted][\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!sans] [cabin] [\s!name]
        \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] [\s!name]
        \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] [xcharter,xcharter-nt][\s!name]
        \checkedmapfontsize[\typescripttwo][\s!script]      [.70]
        \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55]
    \stoptypescript

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

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

    \starttypescript [xcharter,xcharter-nt]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [xcharter]       [\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
