%D \module
%D   [       file=type-imp-dejavu,
%D        version=2010.06.21,
%D          title=\CONTEXT\ Typescript Macros,
%D       subtitle=Dejavu fonts (dejavu-fonts.org),
%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.

% \definefontfallback[Serif]    [file:notoserif-regular.ttf] [0x0000-0xFFFF] [check=yes,rscale=1.02]
% \definefontfallback[SerifBold][file:notoserif-bold.ttf]    [0x0000-0xFFFF] [check=yes,rscale=1.02]

\definefontfeature[dejavu-condensed-mono][extend=.8]

\starttypescriptcollection[dejavu]

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

    \starttypescript [\s!serif] [dejavu] [\s!name]
        \setups[\s!font:\s!fallback:\s!serif]
        \definefontsynonym [\s!Serif]           [\s!name:dejavuserif]           [\s!features=\s!default,\s!fallbacks=\s!Serif,\s!goodies=dejavu-text]
        \definefontsynonym [\s!SerifBold]       [\s!name:dejavuserifbold]       [\s!features=\s!default,\s!fallbacks=\s!SerifBold,\s!goodies=dejavu-text]
        \definefontsynonym [\s!SerifItalic]     [\s!name:dejavuserifitalic]     [\s!features=\s!default,\s!fallbacks=\s!SerifItalic,\s!goodies=dejavu-text]
        \definefontsynonym [\s!SerifBoldItalic] [\s!name:dejavuserifbolditalic] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic,\s!goodies=dejavu-text]
    \stoptypescript

    \starttypescript [\s!sans] [dejavu] [\s!name]
        \setups[\s!font:\s!fallback:\s!sans]
        \definefontsynonym [\s!Sans]           [\s!name:dejavusans]            [\s!features=\s!default,\s!fallbacks=\s!Sans]
        \definefontsynonym [\s!SansBold]       [\s!name:dejavusansbold]        [\s!features=\s!default,\s!fallbacks=\s!SansBold]
        \definefontsynonym [\s!SansItalic]     [\s!name:dejavusansoblique]     [\s!features=\s!default,\s!fallbacks=\s!SansItalic]
        \definefontsynonym [\s!SansBoldItalic] [\s!name:dejavusansboldoblique] [\s!features=\s!default,\s!fallbacks=\s!SansBoldItalic]
    \stoptypescript

    \starttypescript [\s!mono] [dejavu] [\s!name]
        \setups[\s!font:\s!fallback:\s!mono]
        \definefontsynonym [\s!Mono]           [\s!name:dejavusansmono]            [\s!features=\s!none,\s!fallbacks=\s!Mono]
        \definefontsynonym [\s!MonoBold]       [\s!name:dejavusansmonobold]        [\s!features=\s!none,\s!fallbacks=\s!MonoBold]
        \definefontsynonym [\s!MonoItalic]     [\s!name:dejavusansmonooblique]     [\s!features=\s!none,\s!fallbacks=\s!MonoItalic]
        \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=\s!none,\s!fallbacks=\s!MonoBoldItalic]
    \stoptypescript

    \starttypescript [\s!math] [dejavu,dejavu-nt,dejavu-condensed]
        \checkedmapfontsize[\typescripttwo][\s!script]      [.70]%.80
        \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55]%.65
    \stoptypescript

    \starttypescript [\s!math] [dejavu] [\s!name]
        \loadfontgoodies[dejavu-math]
        \definefontsynonym[\s!MathRoman]    [\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math,\s!fallbacks=\s!Math]
        \definefontsynonym[\s!MathRomanBold][\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra},\s!goodies=dejavu-math,\s!fallbacks=\s!Math]
    \stoptypescript
    \starttypescript [\s!math] [dejavu-nt] [\s!name]
        \loadfontgoodies[dejavu-math]
        \definefontsynonym[\s!MathRoman]    [\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra}]
        \definefontsynonym[\s!MathRomanBold][\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra}]
    \stoptypescript

    \starttypescript[dejavu,dejavu-nt]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [dejavu]         [\s!default]
        \definetypeface [\typescriptone] [\s!ss] [\s!sans]  [dejavu]         [\s!default]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [dejavu]         [\s!default]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [\typescriptone] [\s!default]
    \stoptypescript

  % \starttypescript[dejavubidi]
  %     \definetypeface [dejavu] [\s!rm] [\s!serif] [dejavu]   [\s!default]
  %     \definetypeface [dejavu] [\s!ss] [\s!sans]  [dejavu]   [\s!default]
  %     \definetypeface [dejavu] [\s!tt] [\s!mono]  [dejavu]   [\s!default]
  %     \definetypeface [dejavu] [\s!mm] [\s!math]  [xitsbidi] [\s!default] [\s!rscale=1.2]
  % \stoptypescript

    \starttypescript [\s!serif] [dejavu-condensed] [\s!name]
        \setups[\s!font:\s!fallback:\s!serif]
        \definefontsynonym [\s!Serif]           [\s!name:dejavuserifcondensed]           [\s!features=\s!default]
        \definefontsynonym [\s!SerifBold]       [\s!name:dejavuserifcondensedbold]       [\s!features=\s!default]
        \definefontsynonym [\s!SerifItalic]     [\s!name:dejavuserifcondenseditalic]     [\s!features=\s!default]
        \definefontsynonym [\s!SerifBoldItalic] [\s!name:dejavuserifcondensedbolditalic] [\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!sans] [dejavu-condensed] [\s!name]
        \setups[\s!font:\s!fallback:\s!sans]
        \definefontsynonym [\s!Sans]           [\s!name:dejavusanscondensed]            [\s!features=\s!default]
        \definefontsynonym [\s!SansBold]       [\s!name:dejavusanscondensedbold]        [\s!features=\s!default]
        \definefontsynonym [\s!SansItalic]     [\s!name:dejavusanscondensedoblique]     [\s!features=\s!default]
        \definefontsynonym [\s!SansBoldItalic] [\s!name:dejavusanscondensedboldoblique] [\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!mono] [dejavu-condensed] [\s!name]
        \setups[\s!font:\s!fallback:\s!mono]
        \definefontsynonym [\s!Mono]           [\s!name:dejavusansmono]            [\s!features=dejavu-condensed-mono]
        \definefontsynonym [\s!MonoBold]       [\s!name:dejavusansmonobold]        [\s!features=dejavu-condensed-mono]
        \definefontsynonym [\s!MonoItalic]     [\s!name:dejavusansmonooblique]     [\s!features=dejavu-condensed-mono]
        \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=dejavu-condensed-mono]
    \stoptypescript

  % \starttypescript [\s!mono] [dejavu-condensed] [\s!name]
  %     \setups[\s!font:\s!fallback:\s!mono]
  %     \definefontsynonym [\s!Mono]           [\s!name:dejavusansmono]            [\s!features=\s!none]
  %     \definefontsynonym [\s!MonoBold]       [\s!name:dejavusansmonobold]        [\s!features=\s!none]
  %     \definefontsynonym [\s!MonoItalic]     [\s!name:dejavusansmonooblique]     [\s!features=\s!none]
  %     \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=\s!none]
  % \stoptypescript

    \starttypescript[dejavu-condensed]
        \definetypeface [dejavu-condensed] [\s!rm] [\s!serif] [dejavu-condensed] [\s!default]
        \definetypeface [dejavu-condensed] [\s!ss] [\s!sans]  [dejavu-condensed] [\s!default]
        \definetypeface [dejavu-condensed] [\s!tt] [\s!mono]  [dejavu-condensed] [\s!default]
        \definetypeface [dejavu-condensed] [\s!mm] [\s!math]  [dejavu]           [\s!default]
    \stoptypescript

\stoptypescriptcollection
