Debian Codegraph @

texmf-dist/source/latex/rwth-ci/rwth-fonts.dtx

raw
1 % \iffalse meta-comment
2 %
3 % RWTH-CI -- Corporate Design for RWTH Aachen University
4 % ----------------------------------------------------------------------------
5 %
6 % Copyright (C) 2025–2026 by Marei Peischl <[email protected]> and Lukas C. Bossert
7 %
8 % ============================================================================
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either version 1.3c
11 % of this license or (at your option) any later version.
12 % The latest version of this license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.3c or later is part of all distributions of LaTeX
15 % version 2008/05/04 or later.
16 %
17 % This work has the LPPL maintenance status `maintained'.
18 %
19 % The Current Maintainer of this work is
20 % Marei Peischl [email protected]
21 %
22 % The development repository can be found at
23 % https://gitlab.git.nrw/rwth-it-center/rwth-latex-templates/rwth-ci
24 % Please use the issue tracker for feedback!
25 %
26 % ============================================================================
27 %
28 % \fi
29 % \iffalse
30 %<*driver>
31 \ProvidesFile{rwth-fonts.dtx}
32 [2026-04-03 v1.2 Fonts for RWTH-CI, Corporate Design of RWTH Aachen University]
33 %</driver>
34 %<@@=ptxcd>
35 %<*identification>
36 \NeedsTeXFormat{LaTeX2e}[2022-10-01]
37 %<package>\ProvidesExplPackage{rwth-fonts}{2026-04-03}{1.2}{Fonts for RWTH-CI}
38 %</identification>
39 %<*driver>
40 \providecommand*{\PtxcdDocDTXfiles}{rwth-fonts.dtx}
41 \providecommand*{\PtxcdDocTitle}{Fonts for RWTH-CI}
42 \input{rwth-ci.dtx}
43 %</driver>
44 % \fi
45 % \begin{documentation}
46 % \section{Font configuration – \pkg{rwth-fonts.sty}}
47 % \end{documentation}
48 % \begin{implementation}
49 % \iffalse
50 %<*initialize>
51 % \fi
52 % \begin{variable}{\g_@@_freefonts_bool,\g_@@_font_error_bool}
53 % Variables corresponding to \option{freefonts}
54 % \begin{macrocode}
55 \bool_new:N \g_@@_freefonts_bool
56 \bool_new:N \g_@@_font_error_bool
57 % \end{macrocode}
58 % \end{variable}
59 % \iffalse
60 %</initialize>
61 %<*declareoptions>
62 % \fi
63 % \begin{macrocode}
64 \keys_define:nn {ptxcd/fonts} {
65 % \end{macrocode}
66 % \iffalse
67 %</declareoptions>
68 %<*options>
69 % \fi
70 % \end{implementation}
71 % \begin{documentation}
72 % \DescribeKeyOption{freefonts=value}{auto}
73 % The Corporate Design is using commercial fonts.
74 % To allow editing documents also on computers without a valid font license, the option \option{freefonts} provides a mechanism for this.
75 % By default the font selection is configured to try to use the official font if available.
76 % And will create a warning if the official setting is not possible.
77 %
78 % Please be aware that chcking font availability slows down the compilation process.
79 % You probably want to set the value to true or false to speed up.
80 % \end{documentation}
81 % \begin{implementation}
82 % \begin{optionenv}{freefonts}
83 % \begin{macrocode}
84 freefonts .choice:,
85 freefonts / true .code:n = {
86 \bool_gset_true:N \g_@@_freefonts_bool
87 \bool_gset_false:N \g_@@_font_error_bool
88 },
89 freefonts / auto .code:n = {
90 \bool_gset_false:N \g_@@_freefonts_bool
91 \bool_gset_false:N \g_@@_font_error_bool
92 },
93 freefonts / false .code:n = {
94 \bool_gset_false:N \g_@@_freefonts_bool
95 \bool_gset_true:N \g_@@_font_error_bool
96 },
97 freefonts .initial:n = auto,
98 freefonts .default:n = true,
99 freefonts .usage:n = load,
100 % \end{macrocode}
101 % \end{optionenv}
102 % \end{implementation}
103 % \begin{documentation}
104 % \DescribeKeyOption{fontdefaults=\meta{boolean}}{false}
105 % Configure if this package is setting any font defaults or only adds a font family matching the requirements.
106 % \end{documentation}
107 % \begin{implementation}
108 % \begin{optionenv}{fontdefaults}
109 % \begin{macrocode}
110 fontdefaults .bool_gset:N = \g_@@_fontdefaults_bool,
111 fontdefaults .initial:n = false,
112 fontdefaults .default:n = true,
113 fontdefaults .usage:n = load,
114 % \end{macrocode}
115 % \end{optionenv}
116 % \iffalse
117 %</options>
118 %<*processoptions>
119 % \fi
120 % \begin{macrocode}
121 }
122 \ProcessKeyOptions[ptxcd/fonts]
123 % \end{macrocode}
124 % \iffalse
125 %</processoptions>
126 %<*body>
127 % \fi
128 % Save the sfdefault to avoid interaction with other parts of the document.
129 % \begin{macrocode}
130 \bool_if:NF \g_@@_fontdefaults_bool {
131 \let\rwth@cached@fdefault\sfdefault
132 }
133
134 \RequirePackage{iftex}
135 % \end{macrocode}
136 % \changes{v1.2-dev}{2026-04-03}{Fix implementation of font choice to work the same way for all compilers.}
137 % \begin{macrocode}
138 \ifPDFTeX
139 \bool_if:NTF \g_@@_freefonts_bool {
140 \RequirePackage{arimo}
141 } {
142 \bool_if:NTF \g_@@_font_error_bool
143 {\use_ii:nnn}
144 {\use:n}
145 {\file_if_exist:nTF {uarial.sty}} {
146 \RequirePackage[scaled]{uarial}
147 } {
148 \RequirePackage{arimo}
149 }
150 }
151 \RequirePackage[T1]{fontenc}
152 \else
153 \RequirePackage{fontspec}
154 \bool_if:NTF \g_@@_freefonts_bool {
155 \RequirePackage{arimo}
156 } {
157 \bool_if:NTF \g_@@_font_error_bool
158 {\use_ii:nnn}
159 {\use:n}
160 {
161 \fontspec_font_if_exist:nTF {Arial}
162 }{
163 \setsansfont[
164 ItalicFont = *-Italic ,
165 BoldFont = *-Bold ,
166 BoldItalicFont = *-BoldItalic
167 ]{Arial}
168 }{
169 \RequirePackage{arimo}
170 }
171 }
172 \fi
173 \bool_if:NTF \g_@@_fontdefaults_bool {
174 \renewcommand*{\familydefault}{\sfdefault}
175 } {
176 \let\rwth@sffamily\sfdefault
177 \let\rwth@cached@sfdefault\sfdefault
178 }
179 \RequirePackage{anyfontsize}
180 % \end{macrocode}
181 % %^^A\cite[22,24]{rwth-ci-basics}
182 % The Design Guideline does not allow any use of italic text.
183 % \cs{emph} is configured to use bold text instead.
184 % \begin{macrocode}
185 \DeclareEmphSequence{\bfseries}
186
187 \cs_if_exist:NF \ptxcd@OrigLaTeXLogo {
188 \bool_if:NF \g_@@_use_LaTeX_Logo_bool {
189 \let\ptxcd@OrigLaTeXLogo\LaTeX
190 \let\ptxcd@OrigTeXLogo\TeX
191 \renewcommand*\LaTeX{LaTeX}
192 \renewcommand*\TeX{TeX}
193 }
194 }
195 % \end{macrocode}
196 % \iffalse
197 %</body>
198 % \fi
199 % \end{implementation}
200 % \Finale
201 \endinput