\ProvidesPackage{biolinum-type1}[%
  2013/02/13 (Bob Tennent) Supports Biolinum type 1 fonts.] 

\RequirePackage{xkeyval,textcomp}

\newif\iflibertine@sfdefault \libertine@sfdefaultfalse
\newif\ifbiolinum@lining \biolinum@liningtrue            % NEW
\newif\ifbiolinum@tabular \biolinum@tabulartrue          % NEW

\def\libertine@newfigdefaults{%
\PackageWarningNoLine{libertine}{%
  ****************************************\MessageBreak
   Figure defaults are now: lining, tabular; \MessageBreak
   for options, see the documentation. \MessageBreak
  ****************************************}
}
\DeclareOptionX{sfdefault}[true]{%
\@nameuse{if#1}\libertine@sfdefaulttrue\fi
}
\DeclareOptionX{lining}[true]{%
\@nameuse{biolinum@lining#1}
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{nf}[true]{%
\@nameuse{biolinum@lining#1}
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{lf}[true]{%
\@nameuse{biolinum@lining#1}
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{oldstyle}[true]{%
\@nameuse{if#1}%
  \biolinum@liningfalse
\else
  \biolinum@liningtrue
\fi
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{osf}[true]{%
\@nameuse{if#1}%
  \biolinum@liningfalse
\else
  \biolinum@liningtrue
\ifbiolinum@lining\libertine@newfigdefaults\fi
\fi
}\DeclareOptionX{sflining}[true]{%
\@nameuse{biolinum@lining#1}
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{sflf}[true]{%
\@nameuse{biolinum@lining#1}
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{sfoldstyle}[true]{%
\@nameuse{if#1}\biolinum@liningfalse\else\biolinum@liningtrue\fi
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{sfosf}[true]{%
\@nameuse{if#1}\biolinum@liningfalse\else\biolinum@liningtrue\fi
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{osfss}[true]{%
\@nameuse{if#1}\biolinum@liningfalse\else\biolinum@liningtrue\fi
\ifbiolinum@lining\libertine@newfigdefaults\fi
}
\DeclareOptionX{tabular}[true]{%
\@nameuse{biolinum@tabular#1}
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}
\DeclareOptionX{t}[true]{%
\@nameuse{biolinum@tabular#1}
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}
\DeclareOptionX{proportional}[true]{%
\@nameuse{if#1}%
  \biolinum@tabularfalse
\else
  \biolinum@tabulartrue
\fi
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}
\DeclareOptionX{p}[true]{%
\@nameuse{if#1}%
  \biolinum@tabularfalse
\else
  \biolinum@tabulartrue
\fi
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}\DeclareOptionX{sftabular}[true]{%
\@nameuse{biolinum@tabular#1}
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}
\DeclareOptionX{sft}[true]{%
\@nameuse{biolinum@tabular#1}
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}
\DeclareOptionX{sfproportional}[true]{%
\@nameuse{if#1}%
  \biolinum@tabularfalse
\else
  \biolinum@tabulartrue
\fi
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}
\DeclareOptionX{sfp}[true]{%
\@nameuse{if#1}%
  \biolinum@tabularfalse
\else
  \biolinum@tabulartrue
\fi
\ifbiolinum@tabular\libertine@newfigdefaults\fi
}


\providecommand*{\LinuxBiolinumT@scale}{1}
\DeclareOptionX{scaled}{\renewcommand*{\LinuxBiolinumT@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\LinuxBiolinumT@scale}{#1}}

\ProcessOptionsX\relax

  \ifbiolinum@lining
    \def\biolinum@figurestyle{LF} 
  \else
    \def\biolinum@figurestyle{OsF} 
  \fi
  \ifbiolinum@tabular
    \def\biolinum@figurealign{T} 
  \else
    \def\biolinum@figurealign{} 
  \fi


  \RequirePackage{fontenc,fontaxes}

% Set main and/or sans fonts:

  \def\biolinum@family{LinuxBiolinumT-\biolinum@figurealign\biolinum@figurestyle}

  \renewcommand*\sfdefault{\biolinum@family} 
  \iflibertine@sfdefault \renewcommand*\familydefault{\biolinum@family} \fi
  \providecommand*\biolinum{\fontfamily{\biolinum@family}\selectfont}
  \providecommand*\biolinumOsF{\fontfamily{LinuxBiolinumT-\biolinum@figurealign OsF}\selectfont}
  \providecommand*\biolinumLF{\fontfamily{LinuxBiolinumT-\biolinum@figurealign LF}\selectfont}

  \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
  \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
  \def\sufigures{\@nomath\sufigures\fontfigurestyle{superior}\selectfont}

\DeclareTextFontCommand{\textsu}{\sufigures}
\let\textsuperior\textsu

% Define \oldstylenums[f] and \liningnums[f]

    % \oldstylenums defined by \textcomp?
    \DeclareTextFontCommand{\liningnums}{}
    \DeclareTextFontCommand{\oldstylenumsf}{\biolinumOsF}
    \DeclareTextFontCommand{\liningnumsf}{\biolinumLF}

% Define \tabularnums[f] and \proportionalnums[f]

    \DeclareTextFontCommand{\tabularnumsf}{\fontfamily{LinuxBiolinumT-T\biolinum@figurestyle}\selectfont}
    \DeclareTextFontCommand{\proportionalnumsf}{\fontfamily{LinuxBiolinumT-\biolinum@figurestyle}\selectfont}

\endinput
