\definefontfeature
[alefeatures]
[mode=node,liga=yes,kern=yes,tlig=yes,
  ccmp=yes,language=dflt,
  protrusion=quality,
  expansion=quality]

\starttypescript [sans] [alegreya,alegreya-light,alegreya-medium]
  %\setups[font:fallback:serif]
  \definefontsynonym[AlegreyaSans-Thin]             [name:AlegreyaSans-Thin]
  \definefontsynonym[AlegreyaSans-ThinItalic]       [name:AlegreyaSans-ThinItalic]
  \definefontsynonym[AlegreyaSans-ThinCaps]         [name:AlegreyaSansSC-Thin]
  \definefontsynonym[AlegreyaSans-ThinItalicCaps]   [name:AlegreyaSansSC-ThinItalic]
  \definefontsynonym[AlegreyaSans-Light]            [name:AlegreyaSans-Light]
  \definefontsynonym[AlegreyaSans-LightItalic]      [name:AlegreyaSans-LightItalic]
  \definefontsynonym[AlegreyaSans-LightCaps]        [name:AlegreyaSansSC-Light]
  \definefontsynonym[AlegreyaSans-LightItalicCaps]  [name:AlegreyaSansSC-LightItalic]
  \definefontsynonym[AlegreyaSans-Regular]          [name:AlegreyaSans-Regular]
  \definefontsynonym[AlegreyaSans-Italic]           [name:AlegreyaSans-Italic]
  \definefontsynonym[AlegreyaSans-Caps]             [name:AlegreyaSansSC-Regular]
  \definefontsynonym[AlegreyaSans-ItalicCaps]       [name:AlegreyaSansSC-Italic]
  \definefontsynonym[AlegreyaSans-Medium]           [name:AlegreyaSans-Medium]
  \definefontsynonym[AlegreyaSans-MediumItalic]     [name:AlegreyaSans-MediumItalic]
  \definefontsynonym[AlegreyaSans-MediumCaps]       [name:AlegreyaSansSC-Medium]
  \definefontsynonym[AlegreyaSans-MediumItalicCaps] [name:AlegreyaSansSC-MediumItalic]
  \definefontsynonym[AlegreyaSans-Bold]             [name:AlegreyaSans-Bold]
  \definefontsynonym[AlegreyaSans-BoldItalic]       [name:AlegreyaSans-BoldItalic]
  \definefontsynonym[AlegreyaSans-BoldCaps]         [name:AlegreyaSansSC-Bold]
  \definefontsynonym[AlegreyaSans-BoldItalicCaps]   [name:AlegreyaSansSC-BoldItalic]
  \definefontsynonym[AlegreyaSans-ExtraBold]        [name:AlegreyaSans-ExtraBold]
  \definefontsynonym[AlegreyaSans-ExtraBoldItalic]  [name:AlegreyaSans-ExtraBoldItalic]
  \definefontsynonym[AlegreyaSans-ExtraBoldCaps]    [name:AlegreyaSansSC-ExtraBold]
  \definefontsynonym[AlegreyaSans-ExtraBoldItalicCaps][name:AlegreyaSansSC-ExtraBoldItalic]
  \definefontsynonym[AlegreyaSans-Black]             [name:AlegreyaSans-Black]
  \definefontsynonym[AlegreyaSans-BlackItalic]       [name:AlegreyaSans-BlackItalic]
  \definefontsynonym[AlegreyaSans-BlackCaps]         [name:AlegreyaSansSC-Black]
  \definefontsynonym[AlegreyaSans-BlackItalicCaps]   [name:AlegreyaSansSC-BlackItalic]
\stoptypescript

\starttypescript [serif] [alegreya]
  \definefontsynonym[AlegreyaSerif-Regular]         [name:Alegreya-Regular]
  \definefontsynonym[AlegreyaSerif-Italic]          [name:Alegreya-Italic]
  \definefontsynonym[AlegreyaSerif-Caps]            [name:AlegreyaSC-Regular]
  \definefontsynonym[AlegreyaSerif-Bold]            [name:Alegreya-Bold]
  \definefontsynonym[AlegreyaSerif-BoldItalic]      [name:Alegreya-BoldItalic]
  \definefontsynonym[AlegreyaSerif-BoldCaps]        [name:AlegreyaSC-Bold]
  \definefontsynonym[AlegreyaSerif-Black]           [name:Alegreya-Black]
  \definefontsynonym[AlegreyaSerif-BlackItalic]     [name:Alegreya-BlackItalic]
  \definefontsynonym[AlegreyaSerif-BlackCaps]       [name:AlegreyaSC-Black]
\stoptypescript

\starttypescript [sans] [alegreya,alegreya-light,alegreya-medium] [name]
  %\setups[font:fallback:sans]
  \definefontsynonym [Sans]           [AlegreyaSans-Regular]     [features=alefeatures]
  \definefontsynonym [SansItalic]     [AlegreyaSans-Italic]      [features=alefeatures]
  \definefontsynonym [SansSlanted]    [AlegreyaSans-Italic]      [features=alefeatures]
  \definefontsynonym [SansBold]       [AlegreyaSans-Bold]        [features=alefeatures]
  \definefontsynonym [SansBoldItalic] [AlegreyaSans-BoldItalic]  [features=alefeatures]
  \definefontsynonym [SansBoldSlanted][AlegreyaSans-BoldItalic]  [features=alefeatures]
  \definefontsynonym [SansCaps]       [AlegreyaSans-Caps]        [features=alefeatures]
  \definefontsynonym [SansThin]         [AlegreyaSans-Thin]      [features=alefeatures]
  \definefontsynonym [SansThinItalic]   [AlegreyaSans-ThinItalic][features=alefeatures]
  \definefontsynonym [SansThinSlanted]  [AlegreyaSans-ThinItalic][features=alefeatures]
  \definefontsynonym [SansThinCaps]     [AlegreyaSans-ThinCaps]  [features=alefeatures]
  \definefontsynonym [SansLight]        [AlegreyaSans-Light]     [features=alefeatures]
  \definefontsynonym [SansLightItalic]  [AlegreyaSans-LightItalic][features=alefeatures]
  \definefontsynonym [SansLightSlanted] [AlegreyaSans-LightItalic][features=alefeatures]
  \definefontsynonym [SansLightCaps]    [AlegreyaSans-LightCaps]  [features=alefeatures]
  \definefontsynonym [SansMedium]       [AlegreyaSans-Medium]     [features=alefeatures]
  \definefontsynonym [SansMediumItalic] [AlegreyaSans-MediumItalic][features=alefeatures]
  \definefontsynonym [SansMediumSlanted][AlegreyaSans-MediumItalic][features=alefeatures]
\stoptypescript

\starttypescript [sans] [alegreya-light] [name]
  \definefontsynonym [Sans]           [AlegreyaSans-Light]         [features=alefeatures]
  \definefontsynonym [SansItalic]     [AlegreyaSans-LightItalic]   [features=alefeatures]
  \definefontsynonym [SansSlanted]    [AlegreyaSans-LightItalic]   [features=alefeatures]
  \definefontsynonym [SansCaps]       [AlegreyaSans-LightCaps]     [features=alefeatures]
  \definefontsynonym [SansBold]       [AlegreyaSans-Medium]        [features=alefeatures]
  \definefontsynonym [SansBoldItalic] [AlegreyaSans-MediumItalic]  [features=alefeatures]
  \definefontsynonym [SansBoldSlanted][AlegreyaSans-MediumItalic]  [features=alefeatures]
\stoptypescript

\starttypescript [sans] [alegreya-medium] [name]
  \definefontsynonym [Sans]           [AlegreyaSans-Medium]         [features=alefeatures]
  \definefontsynonym [SansItalic]     [AlegreyaSans-MediumItalic]   [features=alefeatures]
  \definefontsynonym [SansSlanted]    [AlegreyaSans-MediumItalic]   [features=alefeatures]
  \definefontsynonym [SansCaps]       [AlegreyaSans-MediumCaps]     [features=alefeatures]
  \definefontsynonym [SansBold]       [AlegreyaSans-ExtraBold]        [features=alefeatures]
  \definefontsynonym [SansBoldItalic] [AlegreyaSans-ExtraBoldItalic]  [features=alefeatures]
  \definefontsynonym [SansBoldSlanted][AlegreyaSans-ExtraBoldItalic]  [features=alefeatures]
\stoptypescript

\starttypescript [serif] [alegreya] [name]
  \definefontsynonym [Serif]           [AlegreyaSerif-Regular]     [features=alefeatures]
  \definefontsynonym [SerifItalic]     [AlegreyaSerif-Italic]      [features=alefeatures]
  \definefontsynonym [SerifSlanted]    [AlegreyaSerif-Italic]      [features=alefeatures]
  \definefontsynonym [SerifBold]       [AlegreyaSerif-Bold]        [features=alefeatures]
  \definefontsynonym [SerifBoldItalic] [AlegreyaSerif-BoldItalic]  [features=alefeatures]
  \definefontsynonym [SerifBoldSlanted][AlegreyaSerif-BoldItalic]  [features=alefeatures]
  \definefontsynonym [SerifCaps]       [AlegreyaSerif-Caps]        [features=alefeatures]
\stoptypescript

\starttypescript [alegreya]
  \definetypeface [alegreya] [rm] [serif] [alegreya] [default]
  \definetypeface [alegreya] [ss] [sans]  [alegreya]  [default]
  \definetypeface [alegreya] [tt] [mono]  [default]   [default]
  \definetypeface [alegreya] [mm] [math]  [default]   [default]
\stoptypescript

\starttypescript [alegreya-light]
  \definetypeface [alegreya] [rm] [serif] [alegreya] [default]
  \definetypeface [alegreya] [ss] [sans]  [alegreya-light]  [default]
  \definetypeface [alegreya] [tt] [mono]  [default]   [default]
  \definetypeface [alegreya] [mm] [math]  [default]   [default]
\stoptypescript

\starttypescript [alegreya-medium]
  \definetypeface [alegreya] [rm] [serif] [alegreya] [default]
  \definetypeface [alegreya] [ss] [sans]  [alegreya-medium]  [default]
  \definetypeface [alegreya] [tt] [mono]  [default]   [default]
  \definetypeface [alegreya] [mm] [math]  [default]   [default]
\stoptypescript
