summaryrefslogtreecommitdiff
path: root/fonts/carlito/latex/carlito.sty
blob: 326843f6162166b6fe5dd680c18d40fef0357f71 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{carlito}
    [2014/08/20 (Bob Tennent)  Supports Carlito fonts for LaTeX, pdfLaTeX, luaLaTeX and xeLaTeX.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifcarlito@fontspec 
\ifxetex
  \carlito@fontspectrue
\else\ifluatex
  \carlito@fontspectrue
\else
  \carlito@fontspecfalse
\fi\fi

\newif\ifcarlito@default \carlito@defaultfalse
\newif\ifcarlito@lining \carlito@liningfalse
\newif\ifcarlito@tabular \carlito@tabularfalse

\newcommand*{\Carlito@scale}{1}
\DeclareOptionX{scaled}{\renewcommand*{\Carlito@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\Carlito@scale}{#1}}

\DeclareOptionX{default}{\carlito@defaulttrue}
\DeclareOptionX{sfdefault}{\carlito@defaulttrue}

\DeclareOptionX{osf}{\carlito@liningfalse}
\DeclareOptionX{oldstyle}{\carlito@liningfalse}
\DeclareOptionX{lf}{\carlito@liningtrue}
\DeclareOptionX{lining}{\carlito@liningtrue}
\DeclareOptionX{proportional}{\carlito@tabularfalse}
\DeclareOptionX{p}{\carlito@tabularfalse}
\DeclareOptionX{tabular}{\carlito@tabulartrue}
\DeclareOptionX{t}{\carlito@tabulartrue}

\ProcessOptionsX\relax

\ifcarlito@fontspec
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes}
\fi

\ifcarlito@fontspec
  \ifcarlito@lining
    \def\carlito@figurestyle{Lining}
  \else
    \def\carlito@figurestyle{OldStyle}
  \fi
  \ifcarlito@tabular
    \def\carlito@figurealign{Monospaced} 
  \else
    \def\carlito@figurealign{Proportional} 
  \fi

\else 

  \ifcarlito@lining
    \def\carlito@figurestyle{LF} 
  \else
    \def\carlito@figurestyle{OsF} 
  \fi
  \ifcarlito@tabular
    \def\carlito@figurealign{T} 
  \else
    \def\carlito@figurealign{} 
  \fi

\fi

\ifcarlito@fontspec
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \Carlito@scale ,
        Extension = .ttf }
  \setsansfont
      [ Numbers   = {\carlito@figurestyle,\carlito@figurealign},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic ]
      {Carlito}
  % grab current family in case of subsequent change:
  \let\carlitofamily\sfdefault  
  \ifcarlito@default\renewcommand*\familydefault{\carlitofamily}\fi
  \newfontfamily\carlito
      [ Numbers   = {\carlito@figurestyle,\carlito@figurealign},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic 
      ]
      {Carlito}
   \newfontfamily\carlitoOsF
        [ Numbers = {Proportional,OldStyle},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic 
        ]
        {Carlito}
  \newfontfamily\carlitoLF
        [ Numbers = {Proportional,Lining},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic 
        ]
        {Carlito}
   \newfontfamily\carlitoTLF
        [ Numbers = {Monospaced, Lining},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic 
        ]
        {Carlito}
   \newfontfamily\carlitoTOsF
        [ Numbers = {Monospaced, OldStyle},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic 
        ]
        {Carlito}
  \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}
  \providecommand\infigures{\addfontfeatures{VerticalPosition=ScientificInferior}}

\else 
  \def\carlitofamily{Carlito-\carlito@figurealign\carlito@figurestyle}
  \newcommand*\carlito{\fontfamily{\carlitofamily}\selectfont}
  \def\sfdefault{\carlitofamily}
  \ifcarlito@default\edef\familydefault{\sfdefault}\fi
  \newcommand*\carlitoOsF{\fontfamily{Carlito-OsF}\selectfont}
  \newcommand*\carlitoLF{\fontfamily{Carlito-LF}\selectfont}
  \newcommand*\carlitoTLF{\fontfamily{Carlito-TLF}\selectfont}
  \newcommand*\carlitoTOsF{\fontfamily{Carlito-TOsF}\selectfont}

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

  \fa@naming@exception{figures}{{inferior}{proportional}}{Inf}
  \fa@naming@exception{figures}{{inferior}{tabular}}{Inf}
  \def\infigures{\@nomath\infigures
      \fontfigurestyle{inferior}\selectfont}

\fi

\DeclareTextFontCommand{\textsu}{\sufigures}
\DeclareTextFontCommand{\textin}{\infigures}

\ifcarlito@fontspec
% turn off defaults in case other fonts are selected:
  \defaultfontfeatures{}
\fi

\endinput