\ProvidesPackage{Alegreya}[% 2014/01/16 (Bob Tennent) Supports Alegreya and AlegreyaSC fonts for all LaTeX engines. ] \RequirePackage{ifxetex,ifluatex,textcomp} \newif\ifAlegreya@otf \ifxetex \Alegreya@otftrue \else\ifluatex \Alegreya@otftrue \else % [pdf]LaTeX \Alegreya@otffalse \fi\fi \newif\ifAlegreya@lining \Alegreya@liningtrue \newif\ifAlegreya@tabular \Alegreya@tabularfalse \newif\ifAlegreya@black \Alegreya@blackfalse \newcommand*{\Alegreya@scale}{1} \RequirePackage{xkeyval} \DeclareOptionX{scaled}{\renewcommand*{\Alegreya@scale}{#1}} \DeclareOptionX{scale}{\renewcommand*{\Alegreya@scale}{#1}} \DeclareOptionX{type1}{\Alegreya@otffalse} \DeclareOptionX{lining}[true]{% \@nameuse{if#1}% \Alegreya@liningtrue \else Alegreya@liningfalse \fi } \DeclareOptionX{lf}[true]{% \@nameuse{if#1}% \Alegreya@liningtrue \else Alegreya@liningfalse \fi } \DeclareOptionX{oldstyle}[true]{% \@nameuse{if#1}% \Alegreya@liningfalse \else \Alegreya@liningtrue \fi } \DeclareOptionX{osf}[true]{% \@nameuse{if#1}% \Alegreya@liningfalse \else \Alegreya@liningtrue \fi } \DeclareOptionX{tabular}[true]{% \@nameuse{if#1}% \Alegreya@tabulartrue \else Alegreya@tabularfalse \fi } \DeclareOptionX{tf}[true]{% \@nameuse{if#1}% \Alegreya@tabulartrue \else Alegreya@tabularfalse \fi } \DeclareOptionX{proportional}[true]{% \@nameuse{if#1}% \Alegreya@tabularfalse \else \Alegreya@tabulartrue \fi } \DeclareOptionX{pf}[true]{% \@nameuse{if#1}% \Alegreya@tabularfalse \else \Alegreya@tabulartrue \fi } \def\bfseries@sf{b}\def\Alegreya@boldstyle{Bold} \DeclareOptionX{black}{\edef\bfseries@sf{k}\edef\Alegreya@boldstyle{Black}} \ProcessOptionsX\relax \ifAlegreya@otf \ifAlegreya@lining \def\Alegreya@figurestyle{Lining} \else \def\Alegreya@figurestyle{OldStyle} \fi \ifAlegreya@tabular \def\Alegreya@figurealign{Monospaced} \else \def\Alegreya@figurealign{Proportional} \fi \else % type1 \ifAlegreya@lining \def\Alegreya@figurestyle{LF} \else \def\Alegreya@figurestyle{OsF} \fi \ifAlegreya@tabular \def\Alegreya@figurealign{T} \else \def\Alegreya@figurealign{} \fi \fi \ifAlegreya@otf \RequirePackage{fontspec} \else \RequirePackage{fontenc,fontaxes,mweights} \fi \ifAlegreya@otf \ifxetex\XeTeXtracingfonts=1\fi \defaultfontfeatures{ Ligatures = TeX , Extension = .otf , Scale = \Alegreya@scale , } \setmainfont [ Numbers = {\Alegreya@figurealign,\Alegreya@figurestyle}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} % grab current family in case of subsequent change: \let\Alegreyafamily\rmdefault \def\useosf{% \edef\Alegreya@figurestyle{OldStyle} \defaultfontfeatures{ Ligatures = TeX , Extension = .otf , Scale = \Alegreya@scale , } \setmainfont [ Numbers = {\Alegreya@figurealign,\Alegreya@figurestyle}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} \def\rmfamily{\Alegreya@OsF\def\scshape{\AlegreyaSC}} \rmfamily \defaultfontfeatures{} } \newfontfamily\Alegreya [ Numbers = {\Alegreya@figurealign,\Alegreya@figurestyle}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} \newfontfamily\AlegreyaOsF [ Numbers = {Proportional,OldStyle}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} \newfontfamily\AlegreyaLF [ Numbers = {Proportional,Lining}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} \newfontfamily\AlegreyaTOsF [ Numbers = {Monospaced,OldStyle}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} \newfontfamily\Alegreya@OsF % for \useosf [ Numbers = {\Alegreya@figurealign, OldStyle}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} \newfontfamily\AlegreyaTLF [ Numbers = {Monospaced,Lining}, UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {Alegreya} \newfontfamily\AlegreyaBlack [ Numbers = {\Alegreya@figurealign,\Alegreya@figurestyle}, UprightFont = *-Black , ItalicFont = *-BlackItalic , BoldFont = *-Black , BoldItalicFont = *-BlackItalic ] {Alegreya} \newfontfamily\AlegreyaSC [ UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-\Alegreya@boldstyle , BoldItalicFont = *-\Alegreya@boldstyle Italic ] {AlegreyaSC} \def\rmfamily{\Alegreya\def\scshape{\AlegreyaSC}} \rmfamily \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}} \providecommand\infigures{\addfontfeatures{VerticalPosition=ScientificInferior}} \else % type1 \def\Alegreyafamily{Alegreya-\Alegreya@figurealign \Alegreya@figurestyle} \def\Alegreya{\fontfamily{\Alegreyafamily}\selectfont} \def\AlegreyaLF{\fontfamily{Alegreya-LF}\selectfont} \def\AlegreyaOsF{\fontfamily{Alegreya-OsF}\selectfont} \def\AlegreyaTLF{\fontfamily{Alegreya-TLF}\selectfont} \def\AlegreyaTOsF{\fontfamily{Alegreya-TOsF}\selectfont} \def\AlegreyaBlack{\fontfamily{\Alegreyafamily}\fontseries{k}\selectfont} \def\AlegreyaSC{\fontfamily{AlegreyaSC-TLF}\selectfont} \fa@naming@exception{figures}{{superior}{proportional}}{Sup} \fa@naming@exception{figures}{{superior}{tabular}}{Sup} \providecommand\sufigures{\@nomath\sufigures\fontfigurestyle{superior}\selectfont} \fa@naming@exception{figures}{{inferior}{proportional}}{Inf} \fa@naming@exception{figures}{{inferior}{tabular}}{Inf} \providecommand\infigures{\@nomath\infigures\fontfigurestyle{inferior}\selectfont} \def\rmdefault{\Alegreyafamily} \def\rmfamily{\fontfamily{\Alegreyafamily}\selectfont\def\scshape{\AlegreyaSC}} \rmfamily \def\useosf{\edef\Alegreya@figurestyle{OsF}\renewcommand*{\rmdefault}{Alegreya-\Alegreya@figurealign OsF}} \fi \DeclareTextFontCommand{\textsu}{\sufigures} \DeclareTextFontCommand{\textin}{\infigures} % turn off defaults in case other fonts are selected: \ifAlegreya@otf \defaultfontfeatures{} \fi \endinput