diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /fonts/cabin/latex/cabin.sty |
Initial commit
Diffstat (limited to 'fonts/cabin/latex/cabin.sty')
-rw-r--r-- | fonts/cabin/latex/cabin.sty | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/fonts/cabin/latex/cabin.sty b/fonts/cabin/latex/cabin.sty new file mode 100644 index 0000000000..72642b0534 --- /dev/null +++ b/fonts/cabin/latex/cabin.sty @@ -0,0 +1,121 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{cabin} + [2019/04/24 (Bob Tennent) Supports Cabin fonts for all LaTeX engines.] + +\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp} + +\newif\ifcabin@otf +\ifxetex + \cabin@otftrue +\else\ifluatex + \cabin@otftrue +\else % [pdf]LaTeX + \cabin@otffalse +\fi\fi + +\newif\ifcabin@default \cabin@defaultfalse +\newif\ifcabin@lining \cabin@liningfalse +\newif\ifcabin@tabular \cabin@tabularfalse +\newif\ifcabin@semibold \cabin@semiboldfalse +\newif\ifcabin@medium \cabin@mediumfalse +\newif\ifcabin@condensed \cabin@condensedfalse + +\newcommand*{\Cabin@scale}{1} +\DeclareOptionX{scaled}{\renewcommand*{\Cabin@scale}{#1}} +\DeclareOptionX{scale}{\renewcommand*{\Cabin@scale}{#1}} + +\DeclareOptionX{default}{\cabin@defaulttrue} +\DeclareOptionX{sfdefault}{\cabin@defaulttrue} +\DeclareOptionX{type1}{\cabin@otffalse} +\DeclareOptionX{semibold}{\cabin@semiboldtrue} +\DeclareOptionX{bold}{\cabin@semiboldfalse} +\DeclareOptionX{medium}{\cabin@mediumtrue} +\DeclareOptionX{regular}{\cabin@mediumfalse} +\DeclareOptionX{condensed}{\cabin@condensedtrue} + +\ExecuteOptionsX{bold,regular} +\ProcessOptionsX\relax + +\ifcabin@otf + \def\cabin@boldstyle{Bold} + \ifcabin@semibold\def\cabin@boldstyle{SemiBold}\fi + \def\cabin@regstyle{Regular} + \ifcabin@medium\def\cabin@regstyle{Medium}\fi + +\else % type1 + + \ifcabin@condensed + \def\bfseries@sf{boldcondensed} + \ifcabin@semibold\def\bfseries@sf{semiboldcondensed}\fi + \def\mdseries@sf{condensed} + \ifcabin@medium\def\mdseries@sf{mediumcondensed}\fi + \else + \def\bfseries@sf{bold} + \ifcabin@semibold\def\bfseries@sf{semibold}\fi + \def\mdseries@sf{regular} + \ifcabin@medium\def\mdseries@sf{medium}\fi + \fi +\fi + +\ifcabin@otf + \RequirePackage{fontspec} +\else + \RequirePackage{fontenc,fontaxes,mweights} +\fi + +\ifcabin@otf + \def\cabin@regular{Regular} + \ifxetex\XeTeXtracingfonts=1\fi + \defaultfontfeatures{ + Ligatures = TeX , + Scale = \Cabin@scale , + Extension = .otf } + \ifcabin@condensed + \setsansfont + [ UprightFont = *-\cabin@regstyle , + ItalicFont = *-\ifx\cabin@regstyle\cabin@regular Italic\else\cabin@regstyle Italic\fi , + BoldFont = *-\cabin@boldstyle , + BoldItalicFont = *-\cabin@boldstyle Italic ] + {CabinCondensed} + \else + \setsansfont + [ UprightFont = *-\cabin@regstyle , + ItalicFont = *-\ifx\cabin@regstyle\cabin@regular Italic\else\cabin@regstyle Italic\fi , + BoldFont = *-\cabin@boldstyle , + BoldItalicFont = *-\cabin@boldstyle Italic ] + {Cabin} + \fi + % grab current family in case of subsequent change: + \let\cabinfamily\sfdefault + \ifcabin@default\renewcommand*\familydefault{\cabinfamily}\fi + \newfontfamily\cabin + [ UprightFont = *-\cabin@regstyle , + ItalicFont = *-\ifx\cabin@regstyle\cabin@regular Italic\else\cabin@regstyle Italic\fi , + BoldFont = *-\cabin@boldstyle , + BoldItalicFont = *-\cabin@boldstyle Italic ] + {Cabin} + \newfontfamily\cabincondensed + [ UprightFont = *-\cabin@regstyle , + ItalicFont = *-\ifx\cabin@regstyle\cabin@regular Italic\else\cabin@regstyle Italic\fi , + BoldFont = *-\cabin@boldstyle , + BoldItalicFont = *-\cabin@boldstyle Italic ] + {CabinCondensed} +\else % type1 + \def\cabinfamily{Cabin-TLF} + \newcommand*\cabin{\fontfamily{\cabinfamily}\selectfont} + \newcommand*\cabincondensed{% + \def\bfseries@sf{boldcondensed} + \ifcabin@semibold\def\bfseries@sf{semiboldcondensed}\fi + \def\mdseries@sf{condensed} + \ifcabin@medium\def\mdseries@sf{mediumcondensed}\fi + } + \def\sfdefault{\cabinfamily} + \ifcabin@default\edef\familydefault{\sfdefault}\edef\seriesdefault{\mdseries@sf}\fi +\fi + +\ifcabin@otf +% turn off defaults in case other fonts are selected: + \defaultfontfeatures{} +\fi + +\endinput |