\ProvidesPackage{libertinus-type1}[%
  2021/02/14  (Bob Tennent) Supports libertinus fonts for latex/pdflatex.] 

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}
\newif\iflibertinus@otf
\ifxetex
  \libertinus@otftrue
\else\ifluatex
  \libertinus@otftrue
\else  % [pdf]LaTeX
  \libertinus@otffalse
\fi\fi

\iflibertinus@otf\PackageError{libertinus-type1}{%
\MessageBreak Can't use xelatex or lualatex\MessageBreak with this package}%
{*****************************************\MessageBreak
Process with latex or pdflatex or\MessageBreak 
use libertinus.sty or libertinus-otf.sty.\MessageBreak
*****************************************} 
\fi



\RequirePackage{fontenc,fontaxes}

\newif\iflibertinus@sf \libertinus@sftrue
\newif\iflibertinus@rm \libertinus@rmtrue
\newif\iflibertinus@tt \libertinus@tttrue                  
\newif\iflibertinus@sfdefault \libertinus@sfdefaultfalse
\newif\iflibertinus@semibold \libertinus@semiboldfalse

\DeclareOptionX{sans}[true]{%
\@nameuse{if#1}
 \libertinus@sftrue\libertinus@rmfalse\libertinus@ttfalse
\fi
}
\DeclareOptionX{sf}[true]{%
\@nameuse{if#1}
 \libertinus@sftrue\libertinus@rmfalse\libertinus@ttfalse
\fi
}
\DeclareOptionX{ss}[true]{%
\@nameuse{if#1}
 \libertinus@sftrue\libertinus@rmfalse\libertinus@ttfalse
\fi
}

\DeclareOptionX{serif}[true]{%
\@nameuse{if#1}
  \libertinus@rmtrue\libertinus@sffalse\libertinus@ttfalse
\fi
}
\DeclareOptionX{rm}[true]{%
\@nameuse{if#1}
  \libertinus@rmtrue\libertinus@sffalse\libertinus@ttfalse
\fi
}

\DeclareOptionX{tt}[true]{%
\@nameuse{libertinus@tt#1}
}
\DeclareOptionX{mono}[true]{%
\@nameuse{libertinus@tt#1}
}

\DeclareOptionX{sfdefault}[true]{%
\@nameuse{if#1}\libertinus@sftrue\libertinus@sfdefaulttrue\fi
}

\newif\iflibertinusserif@lining \libertinusserif@liningtrue
\newif\iflibertinusserif@tabular \libertinusserif@tabulartrue
\newif\iflibertinussans@lining \libertinussans@liningtrue  
\newif\iflibertinussans@tabular \libertinussans@tabulartrue     


\DeclareOptionX{lining}[true]{%
\@nameuse{libertinusserif@lining#1}
\@nameuse{libertinussans@lining#1}
}
\DeclareOptionX{nf}[true]{%
\@nameuse{libertinusserif@lining#1}
\@nameuse{libertinussans@lining#1}
}
\DeclareOptionX{lf}[true]{%
\@nameuse{libertinusserif@lining#1}
\@nameuse{libertinussans@lining#1}
}
\DeclareOptionX{oldstyle}[true]{%
\@nameuse{if#1}
  \libertinusserif@liningfalse
  \libertinussans@liningfalse
\else
  \libertinusserif@liningtrue
  \libertinussans@liningtrue
\fi}
\DeclareOptionX{osf}[true]{%
\@nameuse{if#1}
  \libertinusserif@liningfalse
  \libertinussans@liningfalse
\else
  \libertinusserif@liningtrue
  \libertinussans@liningtrue
\fi}

\DeclareOptionX{tabular}[true]{%
  \@nameuse{libertinusserif@tabular#1}
  \@nameuse{libertinussans@tabular#1}
}
\DeclareOptionX{t}[true]{%
  \@nameuse{libertinusserif@tabular#1}
  \@nameuse{libertinussans@tabular#1}
}
\DeclareOptionX{proportional}[true]{%
\@nameuse{if#1}
  \libertinusserif@tabularfalse
  \libertinussans@tabularfalse
\else
  \libertinusserif@tabulartrue
  \libertinussans@tabulartrue
\fi}
\DeclareOptionX{p}[true]{%
\@nameuse{if#1}
  \libertinusserif@tabularfalse
  \libertinussans@tabularfalse
\else
  \libertinusserif@tabulartrue
  \libertinussans@tabulartrue
\fi}

\DeclareOptionX{semibold}[true]{\@nameuse{libertinus@semibold#1}}
\DeclareOptionX{sb}[true]{\@nameuse{libertinus@semibold#1}}
\DeclareOptionX{bold}[true]{%
\@nameuse{if#1}
  \libertinus@semiboldfalse
\else
  \libertinus@semiboldtrue
\fi}

\newcommand*\LibertinusSerif@scale{1}  
\newcommand*\LibertinusSerifDisplayT@scale{1} 
\newcommand*\LibertinusSans@scale{1}
\newcommand*\LibertinusMono@scale{0.85}  % cf. MatchLowerCase  
\newcommand*\LibertinusSerifInitials@scale{1}  
\DeclareOptionX{ScaleRM}{\renewcommand*{\LibertinusSerif@scale}{#1}}
\DeclareOptionX{ScaleSF}{\renewcommand*{\LibertinusSans@scale}{#1}}
\DeclareOptionX{ScaleTT}{\renewcommand*{\LibertinusMono@scale}{#1}}

\ProcessOptionsX\relax

\iflibertinusserif@lining
  \def\libertinusserif@figurestyle{LF}
\else
  \def\libertinusserif@figurestyle{OsF}
\fi

\iflibertinusserif@tabular
  \def\libertinusserif@figurealign{T} 
\else
  \def\libertinusserif@figurealign{} 
\fi
\iflibertinussans@lining
  \def\libertinussans@figurestyle{LF}
\else
  \def\libertinussans@figurestyle{OsF}
\fi

\iflibertinussans@tabular
  \def\libertinussans@figurealign{T} 
\else
  \def\libertinussans@figurealign{} 
\fi

\iflibertinus@semibold
  \def\bfseries@rm{sb}
\else
  \def\bfseries@rm{b}
\fi
\iflibertinus@sf
  \def\bfseries@sf{b}
\fi


\def\libertinusserif@family{LibertinusSerif-\libertinusserif@figurealign\libertinusserif@figurestyle}
\def\libertinussans@family{LibertinusSans-\libertinussans@figurealign\libertinussans@figurestyle}
\iflibertinus@rm \def\rmdefault{\libertinusserif@family} \fi
\iflibertinus@sf \def\sfdefault{\libertinussans@family} \fi 
\iflibertinus@sfdefault\edef\familydefault{\sfdefault}\fi
\iflibertinus@tt \def\ttdefault{LibertinusMono-TLF} \fi
\def\LibertinusSerif{\fontfamily{\libertinusserif@family}\selectfont}
\def\LibertinusSerifSB{\fontfamily{\libertinusserif@family}\fontseries{sb}\selectfont}
\def\LibertinusSerifOsF{\fontfamily{LibertinusSerif-OsF}\selectfont}
\def\LibertinusSerifTLF{\fontfamily{LibertinusSerif-TLF}\selectfont}
\def\LibertinusSerifLF{\fontfamily{LibertinusSerif-LF}\selectfont}
\def\LibertinusSans{\fontfamily{\libertinussans@family}\selectfont}
\def\LibertinusSansOsF{\fontfamily{LibertinusSans-OsF}\selectfont}
\def\LibertinusSansTLF{\fontfamily{LibertinusSans-TLF}\selectfont}
\def\LibertinusSansLF{\fontfamily{LibertinusSans-LF}\selectfont}
\def\LibertinusMono{\fontfamily{LibertinusMono-TLF}\selectfont}
\def\Libertinusinitials{\fontfamily{LibertinusSerifInitials-\libertinusserif@figurealign\libertinusserif@figurestyle}\selectfont}
\def\LibertinusInitials{\fontfamily{LibertinusSerifInitials-\libertinusserif@figurealign\libertinusserif@figurestyle}\selectfont}
\def\LibertinusDisplay{\fontfamily{LibertinusSerifDisplay-\libertinusserif@figurealign\libertinusserif@figurestyle}\selectfont}
\def\LibertinusKeyboard{\fontfamily{LibertinusKeyboard-TLF}\selectfont}

\fa@naming@exception{figures}{{superior}{proportional}}{Sup}
\fa@naming@exception{figures}{{superior}{tabular}}{Sup}
\def\sufigures{\@nomath\sufigures\fontfigurestyle{superior}\selectfont}
\providecommand*\useosf{\edef\libertinusserif@figurestyle{OsF}\edef\libertinussans@figurestyle{OsF}%
   \iflibertinus@rm \renewcommand*\rmdefault{LibertinusSerif-OsF}\fi
   \iflibertinus@sf \renewcommand*\sfdefault{LibertinusSans-OsF}\fi}

\DeclareTextFontCommand{\textsup}{\sufigures}
\let\textsuperior\textsup

\def\libertinusseriflgr{\fontencoding{LGR}\fontfamily{\libertinusserif@family}\selectfont} 
\def\libertinussanslgr{\fontencoding{LGR}\fontfamily{\libertinussans@family}\selectfont} 
