%% $Id: nexus-otf.sty 776 2018-07-05 10:35:40Z herbert $
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.3 or, at your option, any later version.
%%
% Copyright 2018 Herbert Voss hvoss@tug.org
%%
\ProvidesPackage{nexus-otf}[%
   2018/07/05 v. 0.02 (Herbert Voss)  Supports Nexus serif and Nexus Sans ] 

\RequirePackage{ifxetex,ifluatex,textcomp}

\newif\ifNexus@ttf
\ifxetex\Nexus@ttftrue\else\ifluatex\Nexus@ttftrue\else  % [pdf]LaTeX
  \Nexus@ttffalse
\fi\fi

\newif\ifNexus@lining \Nexus@liningtrue
\newif\ifNexus@tabular \Nexus@tabularfalse
\newif\ifNexus@black \Nexus@blackfalse
\newif\ifNexus@pro \Nexus@profalse
\newif\ifNexus@math \Nexus@mathfalse

\RequirePackage{xkeyval}

\DeclareOptionX{pro}[true]{\@nameuse{Nexus@pro#1}}
\DeclareOptionX{math}[true]{\@nameuse{Nexus@math#1}}

\DeclareOptionX{lining}[true]{\@nameuse{Nexus@lining#1}}
\DeclareOptionX{lf}[true]{\@nameuse{if#1}\Nexus@liningtrue\else\Nexus@liningfalse\fi}
\DeclareOptionX{oldstyle}[true]{\@nameuse{if#1}\Nexus@liningfalse\else\Nexus@liningtrue\fi}
\DeclareOptionX{osf}[true]{\@nameuse{if#1}\Nexus@liningfalse\else\Nexus@liningtrue\fi}
\DeclareOptionX{tabular}[true]{\@nameuse{Nexus@tabular#1}}
\DeclareOptionX{tf}[true]{\@nameuse{if#1}\Nexus@tabulartrue\else\Nexus@tabularfalse\fi}
\DeclareOptionX{proportional}[true]{\@nameuse{if#1}\Nexus@tabulartrue\else\Nexus@tabularfalse\fi}
\DeclareOptionX{pf}[true]{\@nameuse{if#1}\Nexus@tabulartrue\else\Nexus@tabularfalse\fi}

\newcommand*\nexusRM@scale{1}  
\newcommand*\nexusSF@scale{1}
\DeclareOptionX{ScaleRM}{\renewcommand*{\nexusRM@scale}{#1}}
\DeclareOptionX{ScaleSF}{\renewcommand*{\nexusSF@scale}{#1}}
\DeclareOptionX{scaled}{\renewcommand*{\nexusRM@scale}{#1}\renewcommand*{\nexusSF@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\nexusRM@scale}{#1}\renewcommand*{\nexusSF@scale}{#1}}

\ProcessOptionsX\relax

\ifNexus@lining\def\Nexus@figurestyle{Lining}\else\def\Nexus@figurestyle{OldStyle}\fi
\ifNexus@tabular\def\Nexus@figurealign{Monospaced}\else\def\Nexus@figurealign{Proportional}\fi

\RequirePackage{unicode-math}

\ifxetex\XeTeXtracingfonts=1\fi
\defaultfontfeatures{
     Ligatures = TeX ,
%     Extension = .ttf,
%     Scale     = \Nexus@scale ,
%     RawFeature=+
}
\setmainfont{NexusSerif}%
      [ Numbers = {\Nexus@figurealign,\Nexus@figurestyle},
        UprightFont    = *-Regular,
        ItalicFont     = *-Italic,
        BoldFont       = *-Bold, 
        BoldItalicFont = *-BoldItalic,
        UprightFeatures = { SmallCapsFont = *-RegularSC },
        BoldFeatures = { SmallCapsFont= *-BoldSC },
        ItalicFeatures = { SmallCapsFont= *-ItalicSC },
        BoldItalicFeatures = {  SmallCapsFont= *-BoldItalicSC },
	Scale          = \nexusRM@scale,
      ]

\ifNexus@pro
  \setsansfont{NexusSansPro}%
      [ Numbers = {\Nexus@figurealign,\Nexus@figurestyle},
        UprightFont    = *,
        ItalicFont     = *-Italic,
        BoldFont       = *-Bold, 
        BoldItalicFont = *-BoldItalic,
        UprightFeatures = { SmallCapsFont = NexusSans-RegularSC },
        BoldFeatures = { SmallCapsFont= NexusSans-BoldSC },
        ItalicFeatures = { SmallCapsFont= NexusSans-ItalicSC },
        BoldItalicFeatures = { SmallCapsFont= NexusSans-BoldItalicSC },
	Scale          = \nexusSF@scale,
      ]
\else
  \setsansfont{NexusSans}%
      [ Numbers = {\Nexus@figurealign,\Nexus@figurestyle},
        UprightFont    = *-Regular,
        ItalicFont     = *-Italic,
        BoldFont       = *-Bold, 
        BoldItalicFont = *-BoldItalic,
        UprightFeatures = { SmallCapsFont = NexusSans-RegularSC },
        BoldFeatures = { SmallCapsFont= NexusSans-BoldSC },
        ItalicFeatures = { SmallCapsFont= NexusSans-ItalicSC },
        BoldItalicFeatures = { SmallCapsFont= NexusSans-BoldItalicSC },
	Scale          = \nexusSF@scale,
      ]
\fi

\ifNexus@math\setmathfont{texgyrepagella-math.otf}\fi

\endinput




\providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}  
\providecommand\infigures{\addfontfeatures{VerticalPosition=ScientificInferior}}

\DeclareTextFontCommand{\textsu}{\sufigures}
\DeclareTextFontCommand{\textin}{\infigures}

\defaultfontfeatures{}

\endinput



<none>	NexusSansTF-Italic	4.460 2004
<none>	NexusSans-BoldItalicSC	4.460 2004
<none>	NexusSerif-RegularSC	4.460 2004
<none>	NexusSans-RegularSC	4.460 2004
<none>	NexusSerif-BoldItalicSC	4.460 2004
<none>	NexusSans-Bold	4.460 2004
<none>	NexusSerifTF-BoldItalic	4.460 2004
<none>	NexusSerif-BoldItalic	4.460 2004
<none>	NexusSansTF-Regular	4.460 2004
<none>	NexusSerif-Bold	4.460 2004
<none>	NexusSans-BoldSC	4.460 2004
<none>	NexusSerif-ItalicSwashTwo	4.460 2004
<none>	NexusSerif-Regular	4.460 2004
<none>	NexusSerif-ItalicSC	4.460 2004
<none>	NexusSerifTF-Regular	4.460 2004
<none>	NexusSansTF-BoldItalic	4.460 2004
<none>	NexusSerifTF-Bold	4.460 2004
<none>	NexusSerifTF-Italic	4.460 2004
<none>	NexusSerif-BoldSC	4.460 2004
<none>	NexusSerif-Italic	4.460 2004
<none>	NexusSerif-ItalicSwashOne	4.460 2004
<none>	NexusSans-Italic	4.460 2004
<none>	NexusSans-ItalicSC	4.460 2004
<none>	NexusSans-BoldItalic	4.460 2004
<none>	NexusSansTF-Bold	4.460 2004
<none>	NexusSans-Regular	4.460 2004
