%D \module
%D   [       file=type-imp-dejavu,
%D        version=2010.06.21,
%D          title=\CONTEXT\ Typescript Macros,
%D       subtitle=Alegreya fonts,
%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 This is cleaned up ersion of thwe one on the wiki. The font can be fetched from:
%D
%D \type {https://www.huertatipografica.com/en/fonts/alegreya-ht-pro}

% \usetypescriptfile[alegreya]
%
% \usebodyfont[alegreya-light]
% \usebodyfont[alegreya-medium]
%
% \setupbodyfont[alegreya]
%
% \setuplayout[tight]
%
% \starttext
%     \switchtobodyfont[alegreya-light]        \input tufte \par
%     \switchtobodyfont[alegreya]              \input tufte \par
%     \switchtobodyfont[alegreya-medium]       \input tufte \par
%     \switchtobodyfont[alegreya-light,sans]   \input tufte \par
%     \switchtobodyfont[alegreya,sans]         \input tufte \par
%     \switchtobodyfont[alegreya-medium,sans]  \input tufte \par
% \stoptext

\starttypescriptcollection[alegreya]

\usetypescriptfile
  [imp-gentium]

\definefontfallback
  [alegreyagentium-fallback]
  [name:gentium]
  [greekandcoptic,greekextended]

\starttypescript [serif] [alegreya-serif,alegreya-light-serif,alegreya-medium-serif] [name]
    \setups[font:fallback:serif]
    \definefontsynonym[Serif]           [name:alegreyaregular]    [features=default,fallbacks=alegreya-gentium-fallback]
    \definefontsynonym[SerifItalic]     [name:alegreyaitalic]     [features=default,fallbacks=alegreya-gentium-fallback]
    \definefontsynonym[SerifBold]       [name:alegreyabold]       [features=default,fallbacks=alegreya-gentium-fallback]
    \definefontsynonym[SerifBoldItalic] [name:alegreyabolditalic] [features=default,fallbacks=alegreya-gentium-fallback]
\stoptypescript

\starttypescript [sans] [alegreya-sans] [name]
    \setups[font:fallback:sans]
    \definefontsynonym [Sans]           [name:alegreyasansregular]    [features=default]
    \definefontsynonym [SansItalic]     [name:alegreyasansitalic]     [features=default]
    \definefontsynonym [SansBold]       [name:alegreyasansbold]       [features=default]
    \definefontsynonym [SansBoldItalic] [name:alegreyasansbolditalic] [features=default]
\stoptypescript

\starttypescript [sans] [alegreya-light-sans] [name]
    \setups[font:fallback:sans]
    \definefontsynonym [Sans]           [name:alegreyasanslight]        [features=default]
    \definefontsynonym [SansItalic]     [name:alegreyasanslightitalic]  [features=default]
    \definefontsynonym [SansBold]       [name:alegreyasansmedium]       [features=default]
    \definefontsynonym [SansBoldItalic] [name:alegreyasansmediumitalic] [features=default]
\stoptypescript

\starttypescript [sans] [alegreya-medium-sans] [name]
    \setups[font:fallback:sans]
    \definefontsynonym [Sans]           [name:alegreyasansmedium]          [features=default]
    \definefontsynonym [SansItalic]     [name:alegreyasansmediumitalic]    [features=default]
    \definefontsynonym [SansBold]       [name:alegreyasansextrabold]       [features=default]
    \definefontsynonym [SansBoldItalic] [name:alegreyasansextrabolditalic] [features=default]
\stoptypescript

\starttypescript [alegreya,alegreya-light,alegreya-medium]
    \definefallbackfamily[alegreya][serif][gentium][range={greekandcoptic,greekextended}]
    \definetypeface [\typescriptone] [rm] [serif] [\typescriptone-serif] [default]
    \definetypeface [\typescriptone] [ss] [sans]  [\typescriptone-sans]  [default]
    \definetypeface [\typescriptone] [tt] [mono]  [modern]               [default]
    \definetypeface [\typescriptone] [mm] [math]  [default]              [default]
\stoptypescript

\stoptypescriptcollection
