%D \module
%D   [       file=type-imp-cambria,
%D        version=2007.07.30,
%D          title=\CONTEXT\ Typescript Macros,
%D       subtitle=Microsoft Cambria,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \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.

%D We use Dejavu as it covers wider range of monospaced glyphs.

\loadtypescriptfile[dejavu]

\starttypescriptcollection[cambria]

    % microsoft: cambria.ttc cambriab.ttf cambriai.ttf cambriaz.ttf
    % ascender : cambmath.ttf cambria.ttf cambriab.ttf cambriai.ttf cambriaz.ttf

    \starttypescript [\s!math,\s!serif] [cambria,cambria-x,cambria-y]
        % whatever matches
        \definefontsynonym [CambriaMath]  [\s!name:cambriamath]
        \definefontsynonym [CambriaSerif] [\s!name:cambria]
    \stoptypescript
    \starttypescript [\s!math,\s!serif] [cambria-m]
        % microsoft cabria
        \definefontsynonym [CambriaMath]  [\s!file:cambria.ttc(Cambria Math)]
        \definefontsynonym [CambriaSerif] [\s!file:cambria.ttc(Cambria)]
    \stoptypescript
    \starttypescript [\s!math,\s!serif] [cambria-a]
        % ascender cambria
        \definefontsynonym [CambriaMath]  [\s!file:cambmath.ttf]
        \definefontsynonym [CambriaSerif] [\s!file:cambria.ttf]
    \stoptypescript

    % We load a goodies file that will apply a patch to the font. As a demonstration
    % we apply the patch when caching as as when scaling which is why we also specify
    % the goodies file with the name.

    \starttypescript [\s!math] [cambria,cambria-m,cambria-a] [\s!name]
        \loadfontgoodies[cambria-math]
        \definefontsynonym [\s!MathRoman] [CambriaMath] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=cambria-math]
    \stoptypescript
    \starttypescript [\s!math] [cambria-x] [\s!name]
        \loadfontgoodies[cambria-math]
        \definefontsynonym [\s!MathRoman] [CambriaMath] [\s!features={\s!math,mathextra},\s!goodies=cambria-math]
    \stoptypescript
    \starttypescript [\s!math] [cambria-y] [\s!name]
        \loadfontgoodies[cambria-math]
        \definefontsynonym [\s!MathRoman] [CambriaMath] [\s!features={\s!math-nostack\mathsizesuffix,mathextra},\s!goodies=cambria-math]
    \stoptypescript

    \starttypescript [\s!serif] [cambria,cambria-m,cambria-a] [\s!name]
        \setups[\s!font:\s!fallback:\s!serif]
        \definefontsynonym [\s!Serif]           [CambriaSerif]              [\s!features=\s!default,\s!goodies=cambria]
        \definefontsynonym [\s!SerifBold]       [\s!name:cambriabold]       [\s!features=\s!default,\s!goodies=cambria]
        \definefontsynonym [\s!SerifItalic]     [\s!name:cambriaitalic]     [\s!features=\s!default,\s!goodies=cambria]
        \definefontsynonym [\s!SerifBoldItalic] [\s!name:cambriabolditalic] [\s!features=\s!default,\s!goodies=cambria]
    \stoptypescript

    \starttypescript [cambria,cambria-m,cambria-a]
        % any
        \definetypeface [cambria] [\s!rm] [\s!serif] [\typescriptone] [\s!default]
        \definetypeface [cambria] [\s!tt] [\s!mono]  [dejavu]         [\s!default]
        \definetypeface [cambria] [\s!mm] [\s!math]  [\typescriptone] [\s!default]
    \stoptypescript
    \starttypescript [cambria-x,cambria-y]
        % test x
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [cambria]        [\s!default]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [dejavu]         [\s!default]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [\typescriptone] [\s!default]
    \stoptypescript

\stoptypescriptcollection
