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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
% Source Code Pro for LaTeX
%
% Silke Hofstra, tex@slxh.nl
%
% This file selects either the OTF or the TYPE1 fonts based on
% the LaTeX engine used.
%
% Licenced under the LPPL v1.3 or higher.
%
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{sourcecodepro}[2013/09/23 v2.2 Adobe's Source Code Pro typeface]
\RequirePackage{ifxetex,ifluatex,xkeyval}
% Switches
\newif\ifsourcecodepro@otf
\newif\ifsourcecodepro@default
\newif\ifsourcecodepro@ttdefault
\newif\ifsourcecodepro@oldstyle
\newif\ifsourcecodepro@black
\newif\ifsourcecodepro@semibold
\newif\ifsourcecodepro@light
\newif\ifsourcecodepro@extralight
% Scaling command
\newcommand*{\SourceCodePro@scale}{1}
% Use OpenType fonts for XeTeX and LuaTeX.
\ifxetex
\sourcecodepro@otftrue
\else
\ifluatex
\sourcecodepro@otftrue
\fi
\fi
\DeclareOptionX{lining} {\sourcecodepro@oldstylefalse}
\DeclareOptionX{nf} {\sourcecodepro@oldstylefalse}
\DeclareOptionX{lf} {\sourcecodepro@oldstylefalse}
\DeclareOptionX{oldstyle} {\sourcecodepro@oldstyletrue}
\DeclareOptionX{osf} {\sourcecodepro@oldstyletrue}
\DeclareOptionX{black} {\sourcecodepro@blacktrue \sourcecodepro@semiboldfalse}
\DeclareOptionX{semibold} {\sourcecodepro@blackfalse\sourcecodepro@semiboldtrue}
\DeclareOptionX{bold} {\sourcecodepro@blackfalse\sourcecodepro@semiboldfalse}
\DeclareOptionX{light} {\sourcecodepro@lighttrue \sourcecodepro@extralightfalse}
\DeclareOptionX{extralight} {\sourcecodepro@lightfalse\sourcecodepro@extralighttrue}
\DeclareOptionX{regular} {\sourcecodepro@lightfalse\sourcecodepro@extralightfalse}
\DeclareOptionX{scale} {\renewcommand*{\SourceCodePro@scale}{#1}}
\DeclareOptionX{scaled} {\renewcommand*{\SourceCodePro@scale}{#1}}
\DeclareOptionX{default} {\sourcecodepro@defaulttrue}
\DeclareOptionX{ttdefault} {\sourcecodepro@ttdefaulttrue}
\DeclareOptionX{nottdefault} {\sourcecodepro@ttdefaultfalse}
\DeclareOptionX{type1} {\sourcecodepro@otffalse}
\DeclareOptionX{t1} {\sourcecodepro@otffalse}
\DeclareOptionX{opentype} {\sourcecodepro@otftrue}
\DeclareOptionX{otf} {\sourcecodepro@otftrue}
% Default options
\ExecuteOptionsX{ttdefault,lining,bold,regular}
\ProcessOptionsX\relax
% Load OpenType files
\ifsourcecodepro@otf
\RequirePackage{fontspec}
% Oldstyle/Lining
\ifsourcecodepro@oldstyle
\def\sourcecodepro@figurestyle{OldStyle}
\else
\def\sourcecodepro@figurestyle{}
\fi
% Black/Semibold/Bold
\ifsourcecodepro@black
\def\sourcecodepro@boldstyle{Black}
\else
\ifsourcecodepro@semibold
\def\sourcecodepro@boldstyle{Semibold}
\else
\def\sourcecodepro@boldstyle{Bold}
\fi
\fi
% Light/ExtraLight/Regular
\ifsourcecodepro@light
\def\sourcecodepro@regstyle{Light}
\else
\ifsourcecodepro@extralight
\def\sourcecodepro@regstyle{ExtraLight}
\else
\def\sourcecodepro@regstyle{Regular}
\fi
\fi
% Shared features
\defaultfontfeatures{
Ligatures = TeX ,
Numbers = \sourcecodepro@figurestyle ,
Scale = \SourceCodePro@scale ,
Extension = .otf }
% Monospace font
\ifsourcecodepro@ttdefault
\setmonofont
[ UprightFont = *-\sourcecodepro@regstyle ,
ItalicFont = *-\sourcecodepro@regstyle ,
BoldFont = *-\sourcecodepro@boldstyle ,
BoldItalicFont = *-\sourcecodepro@boldstyle ]
{SourceCodePro}
\fi
% Font families
% Regular/Bold
\newfontfamily\sourcecodepro
[ UprightFont = *-Regular ,
ItalicFont = *-Regular ,
BoldFont = *-Bold ,
BoldItalicFont = *-Bold ]
{SourceCodePro}
% Light/Semibold
\newfontfamily\sourcecodeprolight
[ UprightFont = *-Light ,
ItalicFont = *-Light ,
BoldFont = *-Semibold ,
BoldItalicFont = *-Semibold ]
{SourceCodePro}
% ExtraLight/Black
\newfontfamily\sourcecodeproextreme
[ UprightFont = *-ExtraLight ,
ItalicFont = *-ExtraLight ,
BoldFont = *-Black ,
BoldItalicFont = *-Black ]
{SourceCodePro}
% Lining figures
\newfontfamily\sourcecodeprolf
[ Numbers = ,
UprightFont = *-\sourcecodepro@regstyle ,
ItalicFont = *-\sourcecodepro@regstyle ,
BoldFont = *-\sourcecodepro@boldstyle ,
BoldItalicFont = *-\sourcecodepro@boldstyle ]
{SourceCodePro}
% Dont keep all default font features
\defaultfontfeatures{}
% Load type1 font.
\else
\RequirePackage[OT1,LY1,T1]{fontenc}
\RequirePackage{mweights}
% Oldstyle/Lining
\ifsourcecodepro@oldstyle
\def\sourcecodepro@figurestyle{OsF}
\else
\def\sourcecodepro@figurestyle{LF}
\fi
% Black/Semibold/Bold
\ifsourcecodepro@black
\def\bfseries@sf{k}
\else
\ifsourcecodepro@semibold
\def\bfseries@sf{sb}
\else
\def\bfseries@sf{b}
\fi
\fi
% Light/ExtraLight/Regular
\ifsourcecodepro@light
\def\bfseries@sf{l}
\else
\ifsourcecodepro@extralight
\def\bfseries@sf{el}
\else
\def\bfseries@sf{m}
\fi
\fi
% Monospace font
\ifsourcecodepro@ttdefault
\renewcommand*
{\ttdefault}
{SourceCodePro-T\sourcecodepro@figurestyle}
\fi
% If source code pro is the default font \oldstylenums needs a new definition.
\ifsourcecodepro@default
\renewcommand*\oldstylenums[1]{%
\begingroup
\ifmmode
\mathgroup\symletters #1%
\else
\fontfamily{SourceCodePro-TOsF}\selectfont #1%
\fi
\endgroup
}
\fi
\fi
% Set default font family
\ifsourcecodepro@default
\let\familydefault\ttdefault
\fi
\endinput
|