Debian Codegraph @

texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx

raw
1 %%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <latex3.github.io/fontspec>
2
3 % \section{User commands}\label{sec:codeuser}
4 %
5 % This section contains the definitions of the commands detailed in
6 % the user documentation. Only the `top level' definitions of the
7 % commands are contained herein; they all use or define macros which
8 % are defined or used later on in \vref{sec:codeinternal}.
9 %
10 % \begin{function}{\fontspec}
11 % \begin{syntax}
12 % |\fontspec| \oarg{options} \marg{font name/file} \oarg{options}
13 % \end{syntax}
14 % Defines a dummy font with specified options and font name/file.
15 % \end{function}
16 %
17 % \begin{function}{\setmainfont,\setsansfont,\setmonofont}
18 % \begin{syntax}
19 % |\setmainfont| \oarg{options} \marg{font name/file} \oarg{options}
20 % \end{syntax}
21 % Defines the standard rm/sf/tt font families with specified options and font name/file.
22 % \end{function}
23 %
24 % \begin{function}{\setmathrm,\setboldmathrm,\setmathsf,\setmathtt}
25 % \begin{syntax}
26 % |\setmathrm| \oarg{options} \marg{font name/file} \oarg{options}
27 % \end{syntax}
28 % Defines the standard |\mathrm|/|sf|/|tt| font families with specified options and font name/file.
29 % |\setboldmathrm| sets the |\mathrm| font when |\boldmath| is active.
30 % \end{function}
31 %
32 % \begin{function}{\setromanfont}
33 % \begin{syntax}
34 % |\setromanfont| \oarg{options} \marg{font name/file} \oarg{options}
35 % \end{syntax}
36 % Deprecated alias for |\setmainfont|.
37 % \end{function}
38 %
39 % \begin{function}{\newfontfamily,\renewfontfamily,\setfontfamily,\providefontfamily}
40 % \begin{syntax}
41 % |\setromanfont| \meta{font switch cs} \oarg{options} \marg{font name/file} \oarg{options}
42 % \end{syntax}
43 % Defines font family as specified, activated using the \meta{font switch cs}.
44 % \end{function}
45 %
46 % \begin{function}{\newfontface,\renewfontface,\setfontface,\providefontface}
47 % \begin{syntax}
48 % |\setromanfont| \meta{font switch cs} \oarg{options} \marg{font name/file} \oarg{options}
49 % \end{syntax}
50 % Defines font family as specified, activated using the \meta{font switch cs}.
51 % Only the exact font specified will be defined, without attempting to find bold/italic/etc.\ shapes.
52 % \end{function}
53 %
54 % \begin{function}{\oldstylenums,\liningnums}
55 % \begin{syntax}
56 % |{\oldstylenums 123} {\liningnums 123}| $\to$ {\rmfamily\oldstylenums 123} {\rmfamily\liningnums 123}
57 % \end{syntax}
58 % Re-implementations of font-switching commands which activate the necessaru font features (|onum| and |lnum| in OpenType).
59 % \end{function}
60 %
61 % \section{Implementation}
62 %
63 % \iffalse
64 % \begin{macrocode}
65 %<*fontspec>
66 % \end{macrocode}
67 % \fi
68 %
69 % \begin{macro}{\fontspec}
70 % \begin{macrocode}
71 \NewDocumentCommand \fontspec { O{} m O{} }
72 {
73 \@@_main_fontspec:nn {#1,#3} {#2}
74 \ignorespaces
75 }
76 % \end{macrocode}
77 % \end{macro}
78 %
79 % \begin{macro}{\setmainfont,\setsansfont,\setmonofont}
80 % \begin{macrocode}
81 \NewDocumentCommand \setmainfont { O{} m O{} }
82 {
83 \@@_main_setmainfont:nn {#1,#3} {#2}
84 \ignorespaces
85 }
86 % \end{macrocode}
87 %
88 % \begin{macrocode}
89 \NewDocumentCommand \setsansfont { O{} m O{} }
90 {
91 \@@_main_setsansfont:nn {#1,#3} {#2}
92 \ignorespaces
93 }
94 % \end{macrocode}
95 %
96 % \begin{macrocode}
97 \NewDocumentCommand \setmonofont { O{} m O{} }
98 {
99 \@@_main_setmonofont:nn {#1,#3} {#2}
100 \ignorespaces
101 }
102 % \end{macrocode}
103 % \end{macro}
104 %
105 % \begin{macro}{\setmathrm,\setboldmathrm,\setmathsf,\setmathtt}
106 % \begin{macrocode}
107 \NewDocumentCommand \setmathrm { O{} m O{} }
108 {
109 \@@_main_setmathrm:nn {#1,#3} {#2}
110 }
111 % \end{macrocode}
112 %
113 % \begin{macrocode}
114 \NewDocumentCommand \setboldmathrm { O{} m O{} }
115 {
116 \@@_main_setboldmathrm:nn {#1,#3} {#2}
117 }
118 % \end{macrocode}
119 %
120 % \begin{macrocode}
121 \NewDocumentCommand \setmathsf { O{} m O{} }
122 {
123 \@@_main_setmathsf:nn {#1,#3} {#2}
124 }
125 % \end{macrocode}
126 %
127 % \begin{macrocode}
128 \NewDocumentCommand \setmathtt { O{} m O{} }
129 {
130 \@@_main_setmathtt:nn {#1,#3} {#2}
131 }
132 % \end{macrocode}
133 % \end{macro}
134 %
135 % \begin{macro}{\setromanfont}
136 % This is the old name for \cs{setmainfont}, retained \emph{ad infinitum}
137 % for backwards compatibility. It was deprecated in 2010.
138 % \begin{macrocode}
139 \NewDocumentCommand \setromanfont { O{} m O{} }
140 {
141 \@@_main_setmainfont:nn {#1,#3} {#2}
142 }
143 % \end{macrocode}
144 % \end{macro}
145 %
146 % \begin{macro}{\newfontfamily,\renewfontfamily,\setfontfamily,\providefontfamily}
147 % \begin{macrocode}
148 \NewDocumentCommand \newfontfamily { m O{} m O{} }
149 {
150 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
151 }
152 % \end{macrocode}
153 %
154 % \begin{macrocode}
155 \NewDocumentCommand \renewfontfamily { m O{} m O{} }
156 {
157 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
158 }
159 % \end{macrocode}
160 %
161 % \begin{macrocode}
162 \NewDocumentCommand \setfontfamily { m O{} m O{} }
163 {
164 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
165 }
166 % \end{macrocode}
167 %
168 % \begin{macrocode}
169 \NewDocumentCommand \providefontfamily { m O{} m O{} }
170 {
171 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
172 }
173 % \end{macrocode}
174 % \end{macro}
175 %
176 % \begin{macro}{\newfontface,\renewfontface,\setfontface,\providefontface}
177 % \begin{macrocode}
178 \NewDocumentCommand \newfontface { m O{} m O{} }
179 {
180 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
181 }
182 % \end{macrocode}
183 %
184 % \begin{macrocode}
185 \NewDocumentCommand \renewfontface { m O{} m O{} }
186 {
187 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
188 }
189 % \end{macrocode}
190 %
191 % \begin{macrocode}
192 \NewDocumentCommand \setfontface { m O{} m O{} }
193 {
194 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
195 }
196 % \end{macrocode}
197 %
198 % \begin{macrocode}
199 \NewDocumentCommand \providefontface { m O{} m O{} }
200 {
201 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
202 }
203 % \end{macrocode}
204 % \end{macro}
205 %
206 % \begin{macro}{\defaultfontfeatures}
207 % This macro takes one argument that consists of all of feature
208 % options that will be applied by default to all subsequent \cs{fontspec} commands.
209 % \begin{macrocode}
210 \NewDocumentCommand \defaultfontfeatures { t+ o m }
211 {
212 \IfNoValueTF {#2}
213 { \@@_set_default_features:nn {#1} {#3} }
214 { \@@_set_font_default_features:nnn {#1} {#2} {#3} }
215 \ignorespaces
216 }
217 % \end{macrocode}
218 % \end{macro}
219 %
220 % \begin{macrocode}
221 \NewDocumentCommand \addfontfeatures {m}
222 {
223 \@@_main_addfontfeatures:n {#1}
224 }
225 % \end{macrocode}
226 %
227 % \begin{macrocode}
228 \NewDocumentCommand \addfontfeature {m}
229 {
230 \@@_main_addfontfeatures:n {#1}
231 }
232 % \end{macrocode}
233 %
234 % \begin{macrocode}
235 \NewDocumentCommand \newfontfeature {mm}
236 {
237 \@@_main_newfontfeature:nn {#1} {#2}
238 }
239 % \end{macrocode}
240 %
241 % \begin{macrocode}
242 \NewDocumentCommand \newAATfeature {mmmm}
243 {
244 \@@_main_newAATfeature:nnnn {#1} {#2} {#3} {#4}
245 }
246 % \end{macrocode}
247 %
248 % \begin{macrocode}
249 \NewDocumentCommand \newopentypefeature {mmm}
250 {
251 \@@_main_newopentypefeature:nnn {#1} {#2} {#3}
252 }
253 % \end{macrocode}
254 %
255 % \begin{macro}{\newICUfeature}
256 % Deprecated.
257 % \begin{macrocode}
258 \NewDocumentCommand \newICUfeature {mmm}
259 {
260 \@@_main_newopentypefeature:nnn {#1} {#2} {#3}
261 }
262 % \end{macrocode}
263 % \end{macro}
264 %
265 % \begin{macrocode}
266 \NewDocumentCommand \aliasfontfeature {mm}
267 {
268 \@@_main_aliasfontfeature:nn {#1} {#2}
269 }
270 % \end{macrocode}
271 %
272 % \begin{macrocode}
273 \NewDocumentCommand \aliasfontfeatureoption {mmm}
274 {
275 \@@_main_aliasfontfeatureoption:nnn {#1} {#2} {#3}
276 }
277 % \end{macrocode}
278 %
279 % \begin{macro}{\newfontscript}
280 % Mostly used internally, but also possibly useful for users, to define new OpenType
281 % `scripts', mapping logical names to OpenType script tags.
282 % \begin{macrocode}
283 \NewDocumentCommand \newfontscript {mm}
284 {
285 \fontspec_new_script:nn {#1} {#2}
286 }
287 % \end{macrocode}
288 % \end{macro}
289 %
290 % \begin{macro}{\newfontlanguage}
291 % Mostly used internally, but also possibly useful for users, to define new OpenType
292 % `languages', mapping logical names to OpenType language tags.
293 % \begin{macrocode}
294 \NewDocumentCommand \newfontlanguage {mm}
295 {
296 \fontspec_new_lang:nn {#1} {#2}
297 }
298 % \end{macrocode}
299 % \end{macro}
300 %
301 % \begin{macrocode}
302 \NewDocumentCommand \DeclareFontExtensions {m}
303 {
304 \@@_main_DeclareFontExtensions:n {#1}
305 }
306 % \end{macrocode}
307 %
308 % \begin{macrocode}
309 \NewDocumentCommand \IfFontFeatureActiveTF {mmm}
310 {
311 \@@_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3}
312 }
313 % \end{macrocode}
314 %
315 % \begin{macro}{\oldstylenums}
316 % This is performed only after the preamble to overwrite any redefinition by \pkg{textcomp}:
317 % \begin{macrocode}
318 \AtBeginDocument
319 {
320 \RenewDocumentCommand \oldstylenums {m}
321 {
322 \@@_main_oldstylenums:n {#1}
323 }
324 }
325 % \end{macrocode}
326 % \end{macro}
327 %
328 % \begin{macro}{\liningnums}
329 % \begin{macrocode}
330 \NewDocumentCommand \liningnums {m}
331 {
332 \@@_main_liningnums:n {#1}
333 }
334 % \end{macrocode}
335 % \end{macro}
336 %
337 % \iffalse
338 % \begin{macrocode}
339 %</fontspec>
340 % \end{macrocode}
341 % \fi
342
343
344 \endinput
345
346 % /©
347 % ------------------------------------------------
348 % The FONTSPEC package <latex3.github.io/fontspec>
349 % ------------------------------------------------
350 % Copyright 2022-2025 The LaTeX project, LPPL "maintainer"
351 % Copyright 2004-2022 Will Robertson
352 % Copyright 2009-2015 Khaled Hosny
353 % Copyright 2013 Philipp Gesang
354 % Copyright 2013-2016 Joseph Wright
355 % ------------------------------------------------
356 % This package is free software and may be redistributed and/or modified under
357 % the conditions of the LaTeX Project Public License, version 1.3c or higher
358 % (your choice): <http://www.latex-project.org/lppl/>.
359 % ------------------------------------------------
360 % ©/