Debian Codegraph @

texmf-dist/source/fonts/chivo/Chivo.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: Chivo.dtx
4 % Copyright (C) 2016-2022 Arash Esbati <arash'at'gnu.org>
5 %
6 % This work may be distributed and/or modified under the conditions
7 % of the LaTeX Project Public License (LPPL), either version 1.3c of
8 % this license or (at your option) any later version. The latest
9 % version of this license is in the file:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % \fi
14 %
15 % \iffalse
16 %<package>\NeedsTeXFormat{LaTeX2e}[2021/06/01]
17 %<package>\ProvidesPackage{Chivo}
18 %<package> [2022/11/15 v2.2 Support for Chivo fonts (AE)]
19 %
20 %<*driver>
21 \documentclass[a4paper]{ltxdoc}
22 \usepackage[familydefault]{Chivo}
23 \usepackage[utf8]{inputenc}
24 \usepackage[OT1,LY1,T1]{fontenc}
25 \usepackage[scaled=1.09]{zlmtt}
26 \usepackage{fonttable,lipsum,array,booktabs}
27 \usepackage{xcolor}
28 \usepackage{caption}
29 \captionsetup[table]{%
30 format = plain ,
31 labelsep = period ,
32 justification = centerlast ,
33 width = 0.8\linewidth ,
34 position = top ,
35 skip = 5pt ,
36 font = small ,
37 labelfont = bf
38 }
39 \usepackage[activate]{microtype}
40 \linespread{1.04}
41 \usepackage{hypdoc}
42 \newcommand*\pkg[1]{\textsf{#1}}
43 \DisableCrossrefs
44 \RecordChanges
45 \setlength\hfuzz{15pt}
46 \hbadness=7000
47 \frenchspacing
48 \raggedbottom
49 \makeatletter
50 \renewcommand\section{\@startsection{section}{1}{\z@}%
51 {-3.5ex \@plus -1ex \@minus -.2ex}%
52 {2.3ex \@plus.2ex}%
53 {\normalfont\sffamily\Large\bfseries}}
54 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
55 {-3.25ex\@plus -1ex \@minus -.2ex}%
56 {1.5ex \@plus .2ex}%
57 {\normalfont\sffamily\large\bfseries}}
58 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
59 {-3.25ex\@plus -1ex \@minus -.2ex}%
60 {1.5ex \@plus .2ex}%
61 {\normalfont\sffamily\normalsize\bfseries}}
62 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
63 {3.25ex \@plus1ex \@minus.2ex}%
64 {-1em}%
65 {\normalfont\sffamily\normalsize\bfseries}}
66 \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
67 {3.25ex \@plus1ex \@minus .2ex}%
68 {-1em}%
69 {\normalfont\sffamily\normalsize\bfseries}}
70 \renewcommand\@makefntext[1]{%
71 \@setpar{%
72 \@@par \@tempdima=\hsize
73 \advance\@tempdima by -1.5em\relax
74 \parshape \@ne 1.5em \@tempdima
75 }%
76 \par \parindent=\z@ \noindent %
77 \hb@xt@ \z@{\hss \hb@xt@ 1.5em{\@thefnmark.\hss}}%
78 #1%
79 }
80 \def\theCodelineNo{%
81 \reset@font\scriptsize
82 \color{gray}\arabic{CodelineNo}%
83 }
84 \makeatother
85 \begin{document}
86 \DocInput{\jobname.dtx}
87 \end{document}
88 %</driver>
89 % \fi
90 %
91 % \CheckSum{274}
92 %
93 % \CharacterTable
94 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
95 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
96 % Digits \0\1\2\3\4\5\6\7\8\9
97 % Exclamation \! Double quote \" Hash (number) \#
98 % Dollar \$ Percent \% Ampersand \&
99 % Acute accent \' Left paren \( Right paren \)
100 % Asterisk \* Plus \+ Comma \,
101 % Minus \- Point \. Solidus \/
102 % Colon \: Semicolon \; Less than \<
103 % Equals \= Greater than \> Question mark \?
104 % Commercial at \@ Left bracket \[ Backslash \\
105 % Right bracket \] Circumflex \^ Underscore \_
106 % Grave accent \` Left brace \{ Vertical bar \|
107 % Right brace \} Tilde \~}
108 %
109 %
110 % \GetFileInfo{\jobname.sty}
111 %
112 % \MakeShortVerb{\"}
113 %
114 % \changes{v2.2}{2022/11/15}{Rename the macros \cs{textin},
115 % \cs{textsu}, \cs{textnu} and \cs{textde}}
116 % \changes{v2.2}{2022/11/15}{Update the fonts to v.2.0, adjust the
117 % package}
118 % \changes{v2.1}{2019/07/20}{Fix a bug in handling of alias keys}
119 % \changes{v2.0}{2019/07/07}{Add the `scaled' key as requested by FMi}
120 % \changes{v2.0}{2019/07/07}{Use NFSS scheme for fonts mapping}
121 % \changes{v2.0}{2019/07/07}{Rewrite major part of the code supporting
122 % 14 fonts. Harmonize the usage of package options over different TeX
123 % engines}
124 % \changes{v2.0}{2019/07/07}{Update OTF fonts to version 1.007 now
125 % consisting of 14 fonts, 843 glyphs each}
126 % \changes{v1.0}{2016/05/01}{Initial version}
127 %
128 % \title{Using \textsf{Chivo} fonts with LaTeX\thanks{This file has
129 % version number \fileversion, last revised \filedate.}}
130 % \author{Arash Esbati}
131 % \date{\filedate}
132 % \maketitle
133 %
134 % \begin{abstract}
135 % \noindent
136 % This package provides the necessary files to use the
137 % \textsf{Chivo} fonts with LaTeX. \textsf{Chivo} is a set of
138 % eighteen fonts provided by Héctor Gatti \& Omnibus-Type Team under
139 % the Open Font License (OFL).
140 % \end{abstract}
141 %
142 % \tableofcontents \clearpage
143 %
144 % \section{Introduction}
145 % \label{sec:introduction}
146 %
147 % \textsf{Chivo}\footnote{Copyright \textcopyright\ 2019, Omnibus-Type
148 % (\url{https://www.omnibus-type.com}).} is a set of eighteen fonts
149 % created by Héctor Gatti \& Omnibus-Type Team and provided by
150 % Omnibus-Type under the SIL Open Font License, Version 1.1. From the
151 % readme:
152 % \begin{quote}
153 % ``Chivo (`goat' in Spanish) is the first Omnibus-Type
154 % neo-grotesque typeface family. It has 9 weight variants, plus
155 % matching italics. Its solidness and balanced strokes give Chivo
156 % both elegance and practicality. Chivo Regular works perfectly in
157 % long-reading texts, while Chivo Black is ideal for headlines,
158 % banners and highlights. Developed by Héctor Gatti, this is an
159 % indispensable ally for any designer.''
160 % \end{quote}
161 %
162 % The fonts were obtained from Omnibus-Type GitHub
163 % repository\footnote{\url{https://github.com/Omnibus-Type/Chivo}}
164 % (v2.002, 18~fonts, 877~glyphs each).
165 %
166 % \section{Installation}
167 % \label{sec:installation}
168 %
169 % I suggest you use MikTeX or TeXlive and wait until the fonts are
170 % distributed for your TeX installation via their package manager.
171 %
172 % \section{Usage}
173 % \label{sec:usage}
174 %
175 % The fonts can be used with traditional (pdf)TeX engine and newer
176 % XeTeX and LuaTeX engines which can access OTF fonts directly. They
177 % are described below. In general, this bundle tries not to be smart
178 % and loads only \pkg{kvoptions.sty} and \pkg{fontaxes.sty} or
179 % \pkg{fontspec.sty}, depending on the used engine. As the result,
180 % some work must be done by the user.
181 %
182 % \subsection{Engine independent options}
183 % \label{sec:engine-indep-opti}
184 %
185 % A package \pkg{Chivo.sty} is provided which can be loaded in the
186 % preamble as usual:
187 % \begin{quote}
188 % "\usepackage{Chivo}"
189 % \end{quote}
190 % Loading the package changes the document's sans serif font to
191 % \textsf{Chivo}. The package offers some options.
192 %
193 % \DescribeMacro{thin\,\textbar\,extralight\,\textbar\,light}
194 % \DescribeMacro{regular\,\textbar\,medium}
195 % The default font series is set with one of "thin", "extralight",
196 % "light", "regular" or "medium"~-- "regular" is the default. It can
197 % be changed like this:
198 % \begin{quote}
199 % "\usepackage[medium]{Chivo}"
200 % \end{quote}
201 %
202 % \DescribeMacro{semibold\,\textbar\,bold}
203 % \DescribeMacro{bold\,\textbar\,extrabold\textbar\,black}
204 % The default bold series is set with one of "semibold", "bold",
205 % "extrabold" or "black"~-- "bold" is the default.
206 %
207 % \clearpage
208 %
209 % \DescribeMacro{lining\,\textbar\,oldstyle}
210 % \DescribeMacro{proportional\,\textbar\,tabular}
211 % The alignment and style for the figures of the document are set by
212 % the options "lining" or "oldstyle" and "proportional" or "tabular".
213 % "lining" and "proportional" are the defaults. Short aliases "lf",
214 % "osf", "prop" and "tab" are also available. Being boolean options,
215 % following example results in proportional oldstyle figures:
216 % \begin{quote}
217 % "\usepackage[lining=false,tabular=false]{Chivo}"
218 % \end{quote}
219 %
220 % \DescribeMacro{familydefault}
221 % The main font of a document can be switched to \textsf{Chivo} with
222 % package option "familydefault" or "familydefault=true", e.g.:
223 % \begin{quote}
224 % "\usepackage[familydefault]{Chivo}"
225 % \end{quote}
226 %
227 % \DescribeMacro{opentype\,\textbar\,type1}
228 % If the automatic engine detection fails, it can be specified by the
229 % user with one of "opentype" or "type1". Note that these option do
230 % not take a boolean value "true" or "false".
231 %
232 % \DescribeMacro{scale\,\textbar\,scaled}
233 % The size of the \textsf{Chivo} fonts can be adjusted with the
234 % "scale" or "scaled" option, e.g.:
235 % \begin{quote}
236 % "\usepackage[scale=0.97]{Chivo}"
237 % \end{quote}
238 %
239 % \subsection{(pdf)LaTeX specific notes}
240 % \label{sec:under-pdflatex}
241 %
242 % OT1, LY1, T1 and TS1 encodings are supported. \pkg{Chivo.sty}
243 % does not load the respective packages, it is up to user to load
244 % them, e.g.:
245 % \begin{quote}
246 % "\usepackage{Chivo}" \\
247 % "\usepackage[T1]{fontenc}"
248 % \end{quote}
249 %
250 % Chivo fonts provide a rich set of figures (see
251 % table~\ref{tab:figures}). With traditional engines,
252 % \pkg{fontaxes.sty} is loaded and the command \cmd{\fontversion} is
253 % available to switch between "lining", "oldstyle", "tabular" and
254 % "proportional" styles and alignments. For other versions the macros
255 % below are provided. Note that the names of these macros used to be
256 % \cs{textsu}, \cs{textin}\footnote{This macro is defined by the
257 % \pkg{hyperref} package.}, \cs{textnu} and \cs{textde}\footnote{These
258 % macros have a great potential to clash with \cs{babeltags}
259 % definitions.}. The is a backward incompatible change in v2.2 of
260 % this package:
261 % \begin{itemize}
262 % \item "\textsuperior" renders its argument in superior figures. \\
263 % "\textsuperior{123}" produces \textsuperior{123}. The
264 % corresponding declaration is "\sufigures".
265 % \item "\textinferior" renders its argument in inferior figures. \\
266 % "\textinferior{123}" produces \textinferior{123}. The
267 % corresponding declaration is "\infigures".
268 % \item "\textnumerator" renders its argument in numerator figures. \\
269 % "\textnumerator{123}" produces \textnumerator{123}. The
270 % corresponding declaration is "\nufigures".
271 % \item "\textdenominator" renders its argument in denominator
272 % figures. \\
273 % "\textdenominator{123}" produces \textdenominator{123}. The
274 % corresponding declaration is "\defigures".
275 % \end{itemize}
276 %
277 % \subsection{XeLaTeX and LuaLaTeX specific notes}
278 % \label{sec:under-xelat-lual}
279 %
280 % These engines can access OTF fonts directly. The standard interface
281 % for this purpose is
282 % \pkg{fontspec.sty}\footnote{\url{https://ctan.org/pkg/fontspec}}.
283 % \pkg{Chivo.sty} detects if XeLaTeX or LuaLaTeX are used and passes
284 % options given to the package to "\setsansfont" via
285 % \cmd{\defaultfeature}. Other \pkg{fontspec.sty} options can be set
286 % with \cmd{\defaultfeature+}:
287 % \begin{quote}
288 % "\usepackage{fontspec}" \\
289 % "\usepackage{Chivo}" \\
290 % "\defaultfontfeatures+[Chivo]{" \\
291 % " Scale = MatchLowercase ," \\
292 % " Color = blue" \\
293 % "}"
294 % \end{quote}
295 % ^^A
296 % Table \ref{tab:font-features} contains a list of available font
297 % features.
298 % \begin{table}[tbp]
299 % \centering
300 % \caption{Chivo font features}
301 % \label{tab:font-features}
302 % \begin{tabular}{@{}>{\ttfamily}ll@{}}
303 % \toprule
304 % aalt & Access All Alternates \\
305 % case & Case-Sensitive Forms \\
306 % ccmp & Glyph Composition/Decomposition \\
307 % cpsp & Capital Spacing \\
308 % dnom & Denominators \\
309 % frac & Fractions \\
310 % kern & Kerning \\
311 % liga & Standard Ligatures \\
312 % lnum & Lining Figures \\
313 % mark & Mark Positioning \\
314 % mkmk & Mark to Mark Positioning \\
315 % numr & Numerators \\
316 % onum & Oldstyle Figures \\
317 % ordn & Ordinals \\
318 % pnum & Proportional Figures \\
319 % sinf & Scientific Inferiors \\
320 % subs & Subscript \\
321 % sups & Superscript \\
322 % tnum & Tabular Figures \\
323 % zero & Slashed Zero \\
324 % \bottomrule
325 % \end{tabular}
326 % \end{table}
327 %
328 % LaTeX font selection macros like \cmd{\fontseries} work with these
329 % engines as well.
330 %
331 % \clearpage
332 %
333 % \section{OT1 encoding font table}
334 % \label{sec:ot1-font-table}
335 %
336 % \xfonttable{OT1}{Chivo-TLF}{m}{n}
337 %
338 % \clearpage
339 %
340 % \section{LY1 encoding font table}
341 % \label{sec:ly1-font-table}
342 %
343 % \xfonttable{LY1}{Chivo-TLF}{m}{n}
344 %
345 % \section{T1 encoding font table}
346 % \label{sec:t1-font-table}
347 %
348 % \xfonttable{T1}{Chivo-TLF}{m}{n}
349 %
350 % \section{TS1 encoding font table}
351 % \label{sec:ts1-font-table}
352 %
353 % \xfonttable{TS1}{Chivo-TLF}{m}{n}
354 %
355 % \clearpage
356 %
357 % \section{Text samples}
358 % \label{sec:text-samples}
359 %
360 % \subsection*{Regular}
361 % \lipsum[1]\lipsum*[2] \quad 1234567890
362 %
363 % \subsection*{Italic}
364 % {\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
365 %
366 % \subsection*{Medium}
367 % {\fontseries{medium}\selectfont\lipsum[1]\lipsum*[2] \quad 1234567890}
368 %
369 % \subsection*{Medium Italic}
370 % {\fontseries{medium}\selectfont\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
371 %
372 % \subsection*{Semi bold}
373 % {\fontseries{sb}\selectfont\lipsum[1]\lipsum*[2] \quad 1234567890}
374 %
375 % \subsection*{Semi bold Italic}
376 % {\fontseries{sb}\selectfont\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
377 %
378 % \subsection*{Bold}
379 % {\bfseries\lipsum[1]\lipsum*[2] \quad 1234567890}
380 %
381 % \subsection*{Bold italic}
382 % {\bfseries\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
383 %
384 % \subsection*{Extra Bold}
385 % {\fontseries{eb}\selectfont\lipsum[1]\lipsum*[2] \quad 1234567890}
386 %
387 % \subsection*{Extra Bold italic}
388 % {\fontseries{eb}\selectfont\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
389 %
390 % \subsection*{Black}
391 % {\fontseries{ub}\selectfont\lipsum[1]\lipsum*[2] \quad 1234567890}
392 %
393 % \subsection*{Black italic}
394 % {\fontseries{ub}\selectfont\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
395 %
396 % \subsection*{Thin}
397 % {\fontseries{el}\selectfont\lipsum[1]\lipsum*[2] \quad 1234567890}
398 %
399 % \subsection*{Thin italic}
400 % {\fontseries{el}\selectfont\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
401 %
402 % \subsection*{Light}
403 % {\fontseries{l}\selectfont\lipsum[1]\lipsum*[2] \quad 1234567890}
404 %
405 % \subsection*{Light italic}
406 % {\fontseries{l}\selectfont\itshape\lipsum[1]\lipsum*[2] \quad 1234567890}
407 %
408 % \subsection*{Figures}
409 %
410 % \begin{table}[!h]
411 % \centering
412 % \caption{Figure styles and alignments}
413 % \label{tab:figures}
414 % \begin{tabular}{@{}ll@{}}
415 % \toprule
416 % Proportional lining & \_\figureversion{prop,lf}0123456789\_ \\
417 % Tabular lining & \_\figureversion{tab,lf}0123456789\_ \\
418 % Proportional oldstyle & \_\figureversion{prop,osf}0123456789\_ \\
419 % Tabular oldstyle & \_\figureversion{tab,osf}0123456789\_ \\
420 % Superiors & \_\sufigures 0123456789\_ \\
421 % Inferiors & \_\infigures 0123456789\_ \\
422 % Numerators & \_\nufigures 0123456789\_ \\
423 % Denominators & \_\defigures 0123456789\_ \\
424 % \bottomrule
425 % \end{tabular}
426 % \end{table}
427 %
428 %
429 % \StopEventually{^^A
430 % \PrintChanges
431 % }
432 %
433 % \clearpage
434 %
435 % \section{Implementation}
436 % \label{sec:implementation}
437 %
438 % Font support files are generated by "autoinst", invoked with:
439 % \begin{verbatim}
440 % autoinst \
441 % --encoding=OT1,T1,LY1 \
442 % --ts1 \
443 % --sanserif \
444 % --nosmallcaps \
445 % --noswash \
446 % --notitling \
447 % --inferiors=subs \
448 % --fractions \
449 % --noornaments \
450 % --ligatures \
451 % --verbose \
452 % Chivo-*.otf
453 % \end{verbatim}
454 % \vspace{-\baselineskip}
455 % We don't use the \pkg{Chivo.sty} generated by "autoinst" and use our
456 % version instead.
457 %
458 % \subsection{Chivo.sty}
459 % \label{sec:chivo.sty}
460 %
461 % \begin{macrocode}
462 %<*package>
463 % \end{macrocode}
464 %
465 % Require the package \pkg{iftex.sty}:
466 % \begin{macrocode}
467 \RequirePackage{iftex}
468 % \end{macrocode}
469 %
470 % First, we need a switch to know which engine is used:
471 % \begin{macrocode}
472 \newif\ifChivo@otf
473 \iftutex % we are in XeTeX or LuaTeX
474 \Chivo@otftrue
475 \else
476 \Chivo@otffalse
477 \fi
478 % \end{macrocode}
479 %
480 % Load the packages we rely on:
481 % \pkg{fontspec.sty}\footnote{\url{https://www.ctan.org/pkg/fontspec}}
482 % for LuaTeX and XeTeX, or
483 % \pkg{fontaxes.sty}\footnote{\url{https://www.ctan.org/pkg/fontaxes}}
484 % for (pdf)LaTeX:
485 % \begin{macrocode}
486 \ifChivo@otf
487 \RequirePackage{fontspec}
488 \else
489 \RequirePackage{fontaxes}
490 \fi
491 % \end{macrocode}
492 %
493 % We use
494 % \pkg{kvoptions}\footnote{\url{https://www.ctan.org/pkg/kvoptions}}
495 % for key handling:
496 % \begin{macrocode}
497 \RequirePackage{kvoptions}
498 % \end{macrocode}
499 % Setup the keyval options:
500 % \begin{macrocode}
501 \SetupKeyvalOptions{%
502 family = Chivo ,
503 prefix = Chivo@
504 }
505 % \end{macrocode}
506 %
507 % The basic strategy for font and figure version related keys is to
508 % declare them as boolean options.
509 % \begin{macrocode}
510 \DeclareBoolOption{thin}
511 \DeclareBoolOption{extralight}
512 \DeclareBoolOption{light}
513 \DeclareBoolOption{regular}
514 \DeclareBoolOption{medium}
515 \DeclareBoolOption{semibold}
516 \DeclareBoolOption{bold}
517 \DeclareBoolOption{extrabold}
518 \DeclareBoolOption{black}
519 \DeclareBoolOption{lining}
520 \DeclareComplementaryOption{oldstyle}{lining}
521 \DeclareBoolOption{tabular}
522 \DeclareComplementaryOption{proportional}{tabular}
523 % \end{macrocode}
524 %
525 % Alias keys are defined with \cmd{\define@key}. Given values to
526 % these keys are passed to the original keys and they are set via
527 % \cmd{\kvsetkeys}.
528 % \begin{macrocode}
529 \define@key{Chivo}{lf}[true]{%
530 \kvsetkeys{Chivo}{lining=#1}%
531 }
532 \define@key{Chivo}{osf}[true]{%
533 \kvsetkeys{Chivo}{oldstyle=#1}%
534 }
535 \define@key{Chivo}{tab}[true]{%
536 \kvsetkeys{Chivo}{tabular=#1}%
537 }
538 \define@key{Chivo}{prop}[true]{%
539 \kvsetkeys{Chivo}{proportional=#1}%
540 }
541 % \end{macrocode}
542 % "scale" and "scaled" keys are special: With (pdf)LaTeX, "scale" is a
543 % string option, "scaled" is an alias and sets \cmd{\Chivo@scale}
544 % which is defined by the "scale" key. With XeLaTeX and LuaLaTeX,
545 % they set the macro \cmd{\Chivo@otf@scale} which is later used in
546 % \cmd{\defaultfontfeatures}.
547 % \begin{macrocode}
548 \ifChivo@otf
549 \newcommand*\Chivo@otf@scale{}
550 \define@key{Chivo}{scale}[1.0]{%
551 \def\Chivo@otf@scale{#1}%
552 }
553 \define@key{Chivo}{scaled}[1.0]{%
554 \def\Chivo@otf@scale{#1}%
555 }
556 \else
557 \DeclareStringOption[1.0]{scale}
558 \define@key{Chivo}{scaled}[1.0]{%
559 \renewcommand*\Chivo@scale{#1}%
560 }
561 \fi
562 % \end{macrocode}
563 %
564 % "familydefault" switches the default font to \textsf{Chivo}:
565 % \begin{macrocode}
566 \DeclareBoolOption{familydefault}
567 % \end{macrocode}
568 %
569 % The next 2 are for users where the automatic engine detection might
570 % fail:
571 % \begin{macrocode}
572 \DeclareVoidOption{opentype}{\Chivo@otftrue}
573 \DeclareVoidOption{type1}{\Chivo@otffalse}
574 % \end{macrocode}
575 %
576 % Execute the default options and process the rest.
577 % \begin{macrocode}
578 \kvsetkeys{Chivo}{regular,bold,lining,proportional}
579 \ProcessKeyvalOptions{Chivo}
580 % \end{macrocode}
581 %
582 % We need some macros to store the figure alignment and style and font
583 % defintions:
584 % \begin{macrocode}
585 \newcommand*\Chivo@figurestyle{}
586 \newcommand*\Chivo@figurealign{}
587 \newcommand*\Chivo@otf@regular{}
588 \newcommand*\Chivo@otf@italic{}
589 \newcommand*\Chivo@otf@bold{}
590 \newcommand*\Chivo@otf@bolditalic{}
591 % \end{macrocode}
592 %
593 % Definition for "thin", "extralight", "light", "regular" and "medium"
594 % keys for all engines:
595 % \begin{macrocode}
596 \ifChivo@regular
597 \ifChivo@otf
598 \def\Chivo@otf@regular{Regular}
599 \def\Chivo@otf@italic{Italic}
600 \else
601 \DeclareFontSeriesDefault[sf]{md}{m}
602 \fi
603 \fi
604 \ifChivo@medium
605 \ifChivo@otf
606 \def\Chivo@otf@regular{Medium}
607 \def\Chivo@otf@italic{MediumItalic}
608 \else
609 \DeclareFontSeriesDefault[sf]{md}{medium}
610 \fi
611 \fi
612 \ifChivo@light
613 \ifChivo@otf
614 \def\Chivo@otf@regular{Light}
615 \def\Chivo@otf@italic{LightItalic}
616 \else
617 \DeclareFontSeriesDefault[sf]{md}{l}
618 \fi
619 \fi
620 \ifChivo@extralight
621 \ifChivo@otf
622 \def\Chivo@otf@regular{ExtraLight}
623 \def\Chivo@otf@italic{ExtraLightItalic}
624 \else
625 \DeclareFontSeriesDefault[sf]{md}{el}
626 \fi
627 \fi
628 \ifChivo@thin
629 \ifChivo@otf
630 \def\Chivo@otf@regular{Thin}
631 \def\Chivo@otf@italic{ThinItalic}
632 \else
633 \DeclareFontSeriesDefault[sf]{md}{ul}
634 \fi
635 \fi
636 % \end{macrocode}
637 %
638 % Definition for "semibold", "bold", "extrabold" and "black" keys for
639 % all engines:
640 % \begin{macrocode}
641 \ifChivo@bold
642 \ifChivo@otf
643 \def\Chivo@otf@bold{Bold}
644 \def\Chivo@otf@bolditalic{BoldItalic}
645 \else
646 \DeclareFontSeriesDefault[sf]{bf}{b}
647 \fi
648 \fi
649 \ifChivo@semibold
650 \ifChivo@otf
651 \def\Chivo@otf@bold{SemiBold}
652 \def\Chivo@otf@bolditalic{SemiBoldItalic}
653 \else
654 \DeclareFontSeriesDefault[sf]{bf}{sb}
655 \fi
656 \fi
657 \ifChivo@extrabold
658 \ifChivo@otf
659 \def\Chivo@otf@bold{ExtraBold}
660 \def\Chivo@otf@bolditalic{ExtraBoldItalic}
661 \else
662 \DeclareFontSeriesDefault[sf]{bf}{eb}
663 \fi
664 \fi
665 \ifChivo@black
666 \ifChivo@otf
667 \def\Chivo@otf@bold{Black}
668 \def\Chivo@otf@bolditalic{BlackItalic}
669 \else
670 \DeclareFontSeriesDefault[sf]{bf}{ub}
671 \fi
672 \fi
673 % \end{macrocode}
674 %
675 % Definition for figure styles for all engines:
676 % \begin{macrocode}
677 \ifChivo@lining
678 \ifChivo@otf
679 \def\Chivo@figurestyle{Lining}
680 \else
681 \def\Chivo@figurestyle{LF}
682 \fi
683 \else
684 \ifChivo@otf
685 \def\Chivo@figurestyle{OldStyle}
686 \else
687 \def\Chivo@figurestyle{OsF}
688 \fi
689 \fi
690 % \end{macrocode}
691 %
692 % Definition for figure alignments for all engines:
693 % \begin{macrocode}
694 \ifChivo@tabular
695 \ifChivo@otf
696 \def\Chivo@figurealign{Monospaced}
697 \else
698 \def\Chivo@figurealign{T}
699 \fi
700 \else
701 \ifChivo@otf
702 \def\Chivo@figurealign{Proportional}
703 \else
704 \def\Chivo@figurealign{}
705 \fi
706 \fi
707 % \end{macrocode}
708 %
709 % Standard setup for \pkg{fontaxes.sty}. This is only relevant for
710 % (pdf)LaTeX:
711 % \begin{macrocode}
712 \ifChivo@otf \else
713 \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
714 \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
715 \def\sufigures{\@nomath\sufigures
716 \fontfigurestyle{superior}\selectfont}
717 \DeclareTextFontCommand{\textsuperior}{\sufigures}
718
719 \fa@naming@exception{figures}{{inferior}{proportional}}{Inf}
720 \fa@naming@exception{figures}{{inferior}{tabular}}{Inf}
721 \def\infigures{\@nomath\infigures
722 \fontfigurestyle{inferior}\selectfont}
723 \DeclareTextFontCommand{\textinferior}{\infigures}
724
725 \fa@naming@exception{figures}{{numerators}{proportional}}{Numr}
726 \fa@naming@exception{figures}{{numerators}{tabular}}{Numr}
727 \def\nufigures{\@nomath\nufigures
728 \fontfigurestyle{numerators}\selectfont}
729 \DeclareTextFontCommand{\textnumerator}{\nufigures}
730
731 \fa@naming@exception{figures}{{denominators}{proportional}}{Dnom}
732 \fa@naming@exception{figures}{{denominators}{tabular}}{Dnom}
733 \def\defigures{\@nomath\defigures
734 \fontfigurestyle{denominators}\selectfont}
735 \DeclareTextFontCommand{\textdenominator}{\defigures}
736 \fi
737 % \end{macrocode}
738 %
739 % For XeLaTeX/LuaLaTeX, we define the font features depending on the
740 % given package options:
741 % \begin{macrocode}
742 \ifChivo@otf
743 \defaultfontfeatures[Chivo]{%
744 Extension = .otf ,
745 Ligatures = {TeX,Common} ,
746 Scale = \Chivo@otf@scale ,
747 UprightFont = *-\Chivo@otf@regular ,
748 ItalicFont = *-\Chivo@otf@italic ,
749 BoldFont = *-\Chivo@otf@bold ,
750 BoldItalicFont = *-\Chivo@otf@bolditalic ,
751 FontFace = {ul}{n}{*-Thin} ,
752 FontFace = {ul}{it}{*-ThinItalic} ,
753 FontFace = {el}{n}{*-ExtraLight} ,
754 FontFace = {el}{it}{*-ExtraLightItalic} ,
755 FontFace = {l}{n}{*-Light} ,
756 FontFace = {l}{it}{*-LightItalic} ,
757 FontFace = {m}{n}{*-Regular} ,
758 FontFace = {m}{it}{*-Italic} ,
759 FontFace = {medium}{n}{*-Medium} ,
760 FontFace = {medium}{it}{*-MediumItalic} ,
761 FontFace = {sb}{n}{*-SemiBold} ,
762 FontFace = {sb}{it}{*-SemiBoldItalic} ,
763 FontFace = {b}{n}{*-Bold} ,
764 FontFace = {b}{it}{*-BoldItalic} ,
765 FontFace = {eb}{n}{*-ExtraBold} ,
766 FontFace = {eb}{it}{*-ExtraBoldItalic} ,
767 FontFace = {ub}{n}{*-Black} ,
768 FontFace = {ub}{it}{*-BlackItalic} ,
769 Numbers = {\Chivo@figurestyle,\Chivo@figurealign}
770 }
771 \fi
772 % \end{macrocode}
773 %
774 % Switch the sans serif font to \textsf{Chivo}. With \pkg{fontspec},
775 % we delay the \cmd{\setsansfont} until "AtBeginDocument" so that user
776 % can provide additional features with \cmd{\defaultfontfeatures+}.
777 % \begin{macrocode}
778 \ifChivo@otf
779 \AtBeginDocument{%
780 \setsansfont{Chivo}%
781 }
782 \else
783 \renewcommand*\sfdefault{%
784 Chivo-\Chivo@figurealign\Chivo@figurestyle
785 }
786 \fi
787 % \end{macrocode}
788 %
789 % Switch the default font if the respective key is given:
790 % \begin{macrocode}
791 \ifChivo@familydefault
792 \ifChivo@otf
793 \AtBeginDocument{%
794 \setmainfont{Chivo}%
795 }
796 \else
797 \renewcommand*\familydefault{\sfdefault}
798 \fi
799 \fi
800 % \end{macrocode}
801 %
802 % Also set the TS1 subset supported by the fonts. LaTeX kernel sets
803 % this as well, but we put it here for the sake of completeness:
804 % \begin{macrocode}
805 \ifChivo@otf \else
806 \DeclareEncodingSubset{TS1}{Chivo-*}{4}
807 \fi
808 % \end{macrocode}
809 %
810 % \begin{macrocode}
811 %</package>
812 % \end{macrocode}
813 %
814 % \Finale
815 %
816 \endinput
817 %
818 % Local Variables:
819 % mode: doctex
820 % TeX-master: t
821 % ispell-check-comments: exclusive
822 % LaTeX-shortvrb-chars: (?\")
823 % End: