summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cabin/cabin.sty
blob: 33f88aca81c423a41573938dfa172ffe3263c9c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cabin}
    [2013/07/20 (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

  \def\bfseries@sf{b}
  \ifcabin@semibold\def\bfseries@sf{sb}\fi
  \def\mdseries@sf{m}
  \ifcabin@medium\def\mdseries@sf{mb}\fi
\fi

\ifcabin@otf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes,mweights}
\fi

\ifcabin@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \Cabin@scale ,
        Extension = .otf }
  \ifcabin@condensed
    \setsansfont
        [ UprightFont    = *-\cabin@regstyle ,
          ItalicFont     = *-\cabin@regstyle Italic ,
          BoldFont       = *-\cabin@boldstyle , 
          BoldItalicFont = *-\cabin@boldstyle Italic ]
        {CabinCondensed}
  \else
    \setsansfont
        [ UprightFont    = *-\cabin@regstyle ,
          ItalicFont     = *-\cabin@regstyle Italic ,
          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     = *-\cabin@regstyle Italic ,
          BoldFont       = *-\cabin@boldstyle , 
          BoldItalicFont = *-\cabin@boldstyle Italic ]
        {Cabin}
  \newfontfamily\cabincondensed
        [ UprightFont    = *-\cabin@regstyle ,
          ItalicFont     = *-\cabin@regstyle Italic ,
          BoldFont       = *-\cabin@boldstyle , 
          BoldItalicFont = *-\cabin@boldstyle Italic ]
        {CabinCondensed}
\else % type1
  \def\cabinfamily{Cabin-TLF}
  \def\cabincondensedfamily{CabinCondensed-TLF}
  \newcommand*\cabin{\fontfamily{\cabinfamily}\selectfont}
  \newcommand*\cabincondensed{\fontfamily{\cabincondensedfamily}\selectfont}
  \def\sfdefault{\cabinfamily}
  \ifcabin@condensed\def\sfdefault{\cabincondensedfamily}\fi  
  \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