summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/fonts/arsenal/arsenal.dtx
blob: 3607489c584172018e62fef1bd1cfea9bfe12d01 (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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
% \iffalse meta-comment
%
% File: arsenal.dtx
% Copyright 2023 by Boris Veytsman
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version.  The latest version
% of this license is in the file
%
%    https://www.latex-project.org/lppl.txt
%
%<*driver>
\documentclass{l3doc}
\usepackage[default]{arsenal}
\usepackage{natbib, booktabs}
\usepackage[tableposition=top]{caption}
\urlstyle{rm}
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{arsenal.sty}
% \title{\pkg{arsenal}---\LaTeX\ support of Arsenal fonts by Andrij Shevchenko}
% \date{\fileversion, \filedate}
% \author{Boris
% Veytsman\thanks{\href{mailto:borisv@lk.net}{borisv@lk.net},
% \href{mailto:boris@varphi.com}{boris@varphi.com}}}
% \maketitle
% \begin{abstract}
%   Arsenal is the font created by Andrij Shevchenko.  It won
%   Ukrainian Type Design Competition `Mystetsky Arsenal' in 2011.
%   This package provides \LaTeX\ support for it and matching math
%   fonts.
% \end{abstract}
% \tableofcontents
% \begin{documentation}
%
%\section{User manual}
%\label{sec:ug}
%
% 
%\subsection{Introduction}
%\label{sec:ug-intro}
%
% In 2011 the Ukrainian Type Design Competition ``Mystetsky Arsenal''
% (\url{http://www.ukrainian-type.com/about/}) was won by the font by
% Andrij Shevchenko.  The competiton was aimed at the creation of a
% modern practical font based on Ukrainian traditions.  The winner is
% remarkable for its clarity and clean shapes.
%
% Later the font was extended by Alexei Vanyashin \& cyreal.org, Nhung
% Nguyen, and Marc Foley (see
% \url{https://github.com/alexeiva/Arsenal}).  The font now supports a
% large number of languages with Latin and Cyrillic alphabet, it has
% real small caps, historic forms, swash capitals and many other
% features.  
%
% This package provides
% \LaTeX\ interface for the font and optionally math support.
%
% Since the font it in \textsc{otf} format, you do need a Unicode
% engine like \XeTeX\ or Lua\TeX\ to use it.  
%
%
%\subsection{Package options}
%\label{sec:ug-options}
%
% \begin{variable}{default, sfdefault, math, scale, Scale}
%   The options for the package use the key-value interface.
%   The part |=true| for the boolean options can be dropped.
%
%   The following options are recognized:
%   \begin{description}
%   \item[default] whether to make Arsenal the main font of the
%     document, either |true| (the default) or |false|.
%   \item[sfdefault] whether to make Arsenal the sans serif font of your
%     document, either |true| or |false| (the default).
%   \item[math] whether to enable math support.  The currently
%     recognized options are |none|, |kpsans|, and |iwona|.  The
%     default depends on whether Arsenal is your main font: it is
%     |iwona| if yes, and |none| otherwise.  If |iwona| is selected, we use
%     \pkg{iwonamath}~\citep{iwonamath}. If |kpsans| is selected,
%     we use \textsc{otf} version of KpSans
%     fonts~\citep{kpfonts-otf}. 
% \item[scale] the scale for the font, by default 0.89.  The option
% |Scale| is a synonym.
%   \end{description}
% \end{variable}
%
%
%\subsection{Font features}
%\label{sec:ug-families}
%
% \begin{function}{\arsenalfamily, \textarsenal}
%   \begin{syntax}
%     \cs{arsenalfamily} \meta{text}
%     \cs{textarsenal}\Arg{text}
%   \end{syntax}
%   The font provides the commands \cs{arsenalfamily} and
%   \cs{textarsenal} for selecting the font.  Alternatively, the NFSS
%   commands \cs{fontfamily}|{arsenal}|\cs{selectfont} can be used to
%   select Arsenal family.
% \end{function}
%
% The font has normal and \textit{italic} shapes, as well as bolded
% \textbf{bold} and \textbf{\itshape bold italic}. It has
% \textsc{Small Caps}, \textsc{\itshape Italic Small Caps},
% \textsc{\bfseries Bold Small Caps} and \textsc{\bfseries\itshape
% Bold Italic Small Caps}.  They are selected by the standard \LaTeX\
% commands.  
%
% \begin{function}{\swshape, \textsw}
%   The font has Swash shape, selected by the commands \cs{swshape}
%   and \cs{textsw}.  There are both normal and bold versions:
%   \textsw{SWASH}, \textsw{\bfseries Bold SWASH}.  Moreover, there is
%   an italic version \textsw{\itshape SWASH},
%   \textsw{\bfseries\itshape Bold SWASH}, and even a small caps
%   version \textsw{\scshape Swash}, \textsw{\scshape\bfseries Bold
%   Swash}.
% 
% \end{function}
%
% The font has other features, such are two alternate forms and
% historic style.  They can be selected by the
% \pkg{fontspec}~\citep{fontspec} commands like
% |\addfontfeatures{Style=Historic}| or
% |\addfontfeautures{Alternate=1}|.  
%
%
%
%\subsection{Special symbols in text}
%\label{sec:chars}
%
% \begin{function}{
%   \texthryvnia,
%   \texttugrik,
%   \texttenge,
%   \textruble
% }
% The font has common currency characters, like \cs{textdollar}
% (\textdollar), \cs{textyen} (\textyen), \cs{textsterling}
% (\textsterling), \cs{texteuro} (\texteuro).  It also defines several
% less common currency characters:
%   \cs{texthryvnia} (\texthryvnia),
%   \cs{texttugrik} (\texttugrik),
%   \cs{texttenge} (\texttenge),
%   \cs{textruble} (\textruble).
% \end{function}
%
% \begin{function}{
%   \textaldine,
%   \textsmilewhite,
%   \textsmileblack
% }
% The font has \cs{textnumero} sign: \textnumero. It also defines some
% less common characters:
%   \cs{textaldine} (\textaldine),
%   \cs{textsmilewhite} (\textsmilewhite)
%   \cs{textsmileblack} (\textsmileblack).
% \end{function}
%
% \end{documentation}
%
%
% \begin{implementation}
%
% \section{Implementation}
% \label{sec:impl}
%
% 
%
%\subsection{Setting up}
%\label{sec:settingup}
%
%
% 
% First, we declare who we are:
%    \begin{macrocode}
%<@@=arsenal>
%<*package>
\ProvidesExplPackage {arsenal}
{2023-09-03} {0.1}
{Arsenal font by Andrij Shevchenko}
%    \end{macrocode}
%
%
%\subsection{Options}
%\label{sec:options}
%
% \begin{variable}{
%   default,
%   sfdefault,
%   math,
%   scale,
%   Scale,
%   \l_@@_default_bool,
%   \l_@@_sfdefault_bool,
%   \l_@@_math_tl,
%   \l_@@_scale_tl,
% }
%    \begin{macrocode}
\tl_new:N \l_@@_math_tl
\keys_define:nn {arsenal}
{
  default .bool_set:N = \l_@@_default_bool,
  defaul .default:n = true,
  sfdefault .bool_set:N = \l_@@_sfdefault_bool,
  sfdefault .default:n = true,
  math .choices:nn = {none, kpsans, iwona}
  {\tl_set_eq:NN \l_@@_math_tl \l_keys_choice_tl },
  scale .tl_set:N = \l_@@_scale_tl,
  Scale .tl_set:N = \l_@@_scale_tl,
}
\keys_set:nn { arsenal }
{
  default=true,
  sfdefault = false,
  scale = 0.89,
}
\tl_clear:N \l_@@_math_tl
%    \end{macrocode}
% \end{variable}
%
% Processing options
%    \begin{macrocode}
\IfFormatAtLeastTF { 2022-06-01 }
  { \ProcessKeyOptions [ arsenal ] }
  {
    \RequirePackage { l3keys2e }
    \ProcessKeysOptions { arsenal }
  }
%    \end{macrocode}
% And setting up math
%    \begin{macrocode}
\tl_if_empty:NT \l_@@_math_tl
{
  \bool_if:NTF \l_@@_default_bool
  {
    \tl_set:Nn \l_@@_math_tl {iwona}
  }
  {
    \tl_set:Nn \l_@@_math_tl {none}
  }
}
%    \end{macrocode}
%
%
%\subsection{Setting up font}
%\label{sec:font}
%
%    \begin{macrocode}
\RequirePackage{fontspec}
\newfontfamily\arsenalfamily{Arsenal-Regular.otf}
[
  NFSSFamily=arsenal,
  Ligatures=TeX,
  Scale=\l_@@_scale_tl,
  ItalicFont = Arsenal-Italic.otf,
  BoldFont = Arsenal-Bold.otf,
  BoldItalicFont = Arsenal-BoldItalic.otf,
  SwashFont = Arsenal-Regular.otf,
  SwashFeatures={Style=Swash},
  BoldSwashFont = Arsenal-Bold.otf,
  BoldSwashFeatures={Style=Swash},
  FontFace = {m}{itsw}{Font = Arsenal-Italic.otf, Style=Swash},
  FontFace = {b}{itsw}{Font = Arsenal-BoldItalic.otf, Style=Swash},
]
%    \end{macrocode}
%
% Checking whether we want the font to be default
%    \begin{macrocode}
\bool_if:NT \l_@@_default_bool
{
  \renewcommand\rmdefault{arsenal}
}

\bool_if:NT \l_@@_sfdefault_bool
{
  \renewcommand\sfdefault{arsenal}
}
%    \end{macrocode}
%
% \begin{macro}{\textarsenal}
%    \begin{macrocode}
\DeclareTextFontCommand{\textarsenal}{\arsenalfamily}
%    \end{macrocode}
% \end{macro}
%
% Swash changing rules
%    \begin{macrocode}
\DeclareFontShapeChangeRule {sw}{it}  {itsw}  {it}
\DeclareFontShapeChangeRule {it}{sw}  {itsw}  {sw}
%    \end{macrocode}
%
% Special characters, absent in the default
% \begin{macro}{
%   \texthryvnia,
%   \texttugrik,
%   \texttenge,
%   \textruble
% }
% Currency symbolse
%    \begin{macrocode}
\DeclareUnicodeSymbol{\texthryvnia}       {"20B4}
\DeclareUnicodeSymbol{\texttugrik}        {"20AE}
\DeclareUnicodeSymbol{\texttenge}         {"20B8}
\DeclareUnicodeSymbol{\textruble}         {"20BD}
%    \end{macrocode}
%   
% \end{macro}
%
% \begin{macro}{
%   \textaldine,
%   \textsmilewhite,
%   \textsmileblack
% }
%  Other symbols
%    \begin{macrocode}
\DeclareUnicodeSymbol{\textaldine}        {"2767}
\DeclareUnicodeSymbol{\textsmilewhite}    {"263A}
\DeclareUnicodeSymbol{\textsmileblack}    {"263B}
%    \end{macrocode}
% \end{macro}
%
%
%\subsection{Math}
%\label{sec:math}
%
% Iwona is simple\ldots
%    \begin{macrocode}
\tl_new:N \l_@@_tmp_tl
\tl_if_eq:NnT \l_@@_math_tl {iwona}
{
  \tl_set:Nn \l_@@_tmp_tl {\fp_to_tl:n {\l_@@_scale_tl * 1.1}}
  \RequirePackage[Scale=\l_@@_tmp_tl, condensed, light]{iwonamath}
}
%    \end{macrocode}
%
% Now kpsans.  Mostly from~\citep{kpfonts-otf}.
%    \begin{macrocode}
\tl_if_eq:NnT \l_@@_math_tl {kpsans}
{
  \tl_set:Ne \l_@@_tmp_tl {\fp_to_tl:n {\l_@@_scale_tl * 1.1}}
  \RequirePackage[symbols]{kpfonts-otf}
  \setmathfont{KpMath-Sans.otf}[
  Scale=\l_@@_tmp_tl,
  BoldFont=KpMath-SansBold.otf]

  \setmathfont{KpMath-Sans.otf}[
  range={cal,bfcal},
  RawFeature=+ss01,
  Scale=\l_@@_tmp_tl,
  BoldFont=KpMath-SansBold.otf]
  
}
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
% \end{implementation}
%
% \bibliography{arsenal}
% \bibliographystyle{plainnat}
%
%
%\PrintIndex
%