Debian Codegraph @

texmf-dist/source/latex/nfssext-cfr/nfssext-cfr.dtx

raw
1 % \iffalse meta-comment
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % nfssext-cfr.dtx
4 % Additions and changes Copyright (C) 2008-2025 Clea F. Rees.
5 % Code from skeleton.dtx Copyright (C) 2015-2024 Scott Pakin (see below).
6 %
7 % This work may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either version 1.3c
9 % of this license or (at your option) any later version.
10 % The latest version of this license is in
11 % https://www.latex-project.org/lppl.txt
12 % and version 1.3c or later is part of all distributions of LaTeX
13 % version 2008-05-04 or later.
14 %
15 % This work has the LPPL maintenance status 'muaintained'.
16 %
17 % The Current Maintainer of this work is Clea F. Rees.
18 %
19 % This work consists of all files listed in manifest.txt.
20 %
21 % The file nfssext-cfr.dtx is a derived work under the terms of the
22 % LPPL. It is based on version 2.4 of skeleton.dtx which is part of
23 % dtxtut by Scott Pakin. A copy of dtxtut, including the
24 % unmodified version of skeleton.dtx is available from
25 % https://www.ctan.org/pkg/dtxtut and released under the LPPL.
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 % \fi
28 %
29 % \iffalse
30 %<*driver>
31 \RequirePackage{svn-prov}
32 % ^^A \def\MakePrivateLetters{\makeatletter\ExplSyntaxOn\endlinechar13}
33 % ^^A \def\MyMakePrivateLetters{\makeatletter\ExplSyntaxOn\endlinechar13}
34 \ExplSyntaxOn
35 % ^^A sylwad yannisl: https://tex.stackexchange.com/questions/723293/how-can-i-get-automatic-code-indexing-of-expl3-in-ltxdoc/723294#comment1799661_723294
36 % ^^A \ExplSyntaxOn \cs_gset:Npn \MakePrivateLetters { \char_set_catcode_letter:N \@ \char_set_catcode_letter:N _ \char_set_catcode_letter:N \: } \ExplSyntaxOff`
37 \cs_new_nopar:Npn \MyMakePrivateLetters
38 {
39 \char_set_catcode_letter:N \@
40 \char_set_catcode_letter:N _
41 \char_set_catcode_letter:N \:
42 }
43 \ExplSyntaxOff
44 \ProvidesFileSVN{$Id: nfssext-cfr.dtx 11042 2025-06-22 22:34:34Z cfrees $}[v1.3 \revinfo][\filebase DTX: Extended font selection for NFSS and NNFSS]
45 \DefineFileInfoSVN[nfssext-cfr]
46 \documentclass[10pt,british]{ltxdoc}
47 % l3doc loads fancyvrb
48 % fancyvrb overwrites svn-prov's macros without warning
49 % restore \fileversion \filerev in case we're using l3doc
50 \GetFileInfoSVN{nfssext-cfr}
51 \usepackage[debug]{nfssext-cfr}
52 \pdfmapfile{-clm.map}
53 \pdfmapfile{+clm.map}
54 \usepackage[rm={prop,osf},sf={prop,osf},tt={mono,tab,lf}]{cfr-lm}
55 \EnableCrossrefs
56 \CodelineIndex
57 \RecordChanges
58 \DoNotIndex{\verb,\ProvidesPackageSVN,\NeedsTeXFormat,\ProcessKeyOptions}
59 \usepackage{babel}
60 \usepackage{fancyhdr}
61 % \usepackage[plain]{fancyref}
62 \usepackage{fixfoot}
63 \usepackage{array}
64 \usepackage{tabularx}
65 \usepackage{longtable}
66 \usepackage{booktabs}
67 \usepackage{multirow}
68 \usepackage[inline]{enumitem}
69 \usepackage[referable]{threeparttablex}
70 \makeatletter
71 \def\TPT@measurement{% ateb David Carlisle: https://tex.stackexchange.com/a/370691/
72 \ifdim\wd\@tempboxb<\TPTminimum
73 \hsize \TPTminimum
74 \else
75 \hsize\wd\@tempboxb
76 \fi
77 \xdef\TPT@hsize{\hsize\the\hsize \noexpand\@parboxrestore}\TPT@hsize
78 \ifx\TPT@docapt\@undefined\else
79 \TPT@docapt \vskip.2\baselineskip
80 \fi \par
81 \dimen@\dp\@tempboxb % new
82 \box\@tempboxb
83 \ifvmode \prevdepth\dimen@ \fi% was \z@ not \dimen@
84 }
85 \renewlist{tablenotes}{enumerate}{1}
86 \setlist[tablenotes]{label=\tnote{\sffamily\alph*},ref=\alph*,itemsep=\z@,topsep=\z@skip,partopsep=\z@skip,parsep=\z@,itemindent=\z@,labelindent=\tabcolsep,labelsep=.2em,leftmargin=*,align=left,before={\unskip\medskip\rmfamily\lstyle\footnotesize}}
87 \makeatother
88 \usepackage{xcolor}
89 \usepackage{xurl}
90 \urlstyle{sf}
91 \usepackage{microtype}
92 %^^A \usepackage[a4paper,headheight=14pt,marginparwidth=45mm,hmarginratio=4:1,vscale=.8,hscale=.7,verbose]{geometry} % use 14pt for 11pt text, 15pt for 12pt text
93 %^^A \usepackage[a4paper,headheight=14pt,vscale=.8,hscale=.7,verbose,showframe]{geometry} % use 14pt for 11pt text, 15pt for 12pt text
94 %^^A \usepackage[verbose,showframe,marginparwidth=130pt,a4paper,includemp,hscale=0.8]{geometry}
95 % addaswyd o chronos.tex
96 \newlength\tewadjust
97 \newlength\chronosdoctemplgth
98 \AddToHook {begindocument/after}[.]
99 {%
100 \setlength\tewadjust{\marginparwidth+\marginparsep-\paperwidth+\textwidth+\oddsidemargin+1in}%
101 \setlength\chronosdoctemplgth{0pt}%
102 }
103 \usepackage{csquotes}
104 \MakeAutoQuote{‘}{’}
105 \MakeAutoQuote*{“}{”}
106 \usepackage{caption}
107 \DeclareCaptionFont{lf}{\sffamily\lstyle}
108 \captionsetup[table]{labelfont=lf}
109 % sicrhau hyperindex=false: llwytho CYN bookmark
110 \usepackage{hypdoc}% ateb Ulrike Fischer: https://tex.stackexchange.com/a/695555/
111 \usepackage{bookmark}
112 \hypersetup{%
113 colorlinks=true,
114 citecolor={moss},
115 extension=pdf,
116 linkcolor={strawberry},
117 linktocpage=true,
118 pdfcreator={TeX},
119 pdfproducer={pdfeTeX},
120 urlcolor={blueberry}%
121 }
122 \NewDocElement[%
123 idxtype=opt.,
124 idxgroup=options,
125 printtype=\textit{opt.},
126 ]{Opt}{option}
127 \NewDocElement[%
128 idxtype=pkg.,
129 idxgroup=,
130 printtype=\textit{pkg.},
131 ]{Pkg}{package}
132 \NewDocElement[%
133 printtype=\textdagger,
134 idxtype=,
135 idxgroup=,
136 macrolike,
137 ]{DMacro}{dmacro}
138 \NewDocumentCommand \val { m }
139 {%
140 {\ttfamily =\,\meta{#1}}%
141 }
142 \ExplSyntaxOn
143 \NewDocumentCommand \vals { m }
144 {
145 {
146 \ttfamily = \,
147 \clist_use:nn { #1 } { \textbar }
148 }
149 }
150 \keys_define:nn { clm / doc }
151 {
152 unknown .code:n = {
153 \cs_if_free:cT { \l_keys_key_str }
154 {
155 \tl_gset:cn { \l_keys_key_str } { #1 }
156 }
157 },
158 }
159 \NewDocumentCommand \clmdocset { +m }
160 {
161 \keys_set:nn { clm / doc } { #1 }
162 }
163 \ExplSyntaxOff
164 \clmdocset{%
165 bug={\href{https://codeberg.org/cfr/nfssext/issues}{\textsc{bugtracker}}},
166 codeberg={\href{https://codeberg.org/cfr/nfssext}{\textsc{codeberg}}},
167 github={\href{https://github.com/cfr42/nfssext}{\textsc{github}}},
168 ctan={\href{https://ctan.org/}{\textsc{ctan}}},
169 }
170 \AddToHook {env/threeparttable/begin} {\typeout{Bagpuss}\sffamily}
171 \usepackage{cleveref}
172 \newcommand*{\gust}{\textsc{Gust}}
173 \newcommand*{\lpack}[1]{\textsf{#1}}
174 \newcommand*{\fgroup}[1]{\textsf{#1}}
175 \newcommand*{\fname}[1]{\textsf{#1}}
176 \newcommand*{\file}[1]{\texttt{#1}}
177 \newcommand*{\mail}[1]{\texttt{#1}}
178 % \newcommand*{\pkg}[1]{\mbox{\textsf{#1}}}
179 \newcommand* \nfss {\textsc{nfss}}
180 \newcommand* \nnfss {\textsc{nnfss}}
181 \newcommand* \svn {\textsc{svn}}
182 \title{\filebase}
183 \author{Clea F. Rees\thanks{%
184 Bug tracker:
185 \href{https://codeberg.org/cfr/nfssext/issues}{\url{codeberg.org/cfr/nfssext/issues}}
186 \textbar{} Code:
187 \href{https://codeberg.org/cfr/nfssext}{\url{codeberg.org/cfr/nfssext}}
188 \textbar{} Mirror:
189 \href{https://github.com/cfr42/nfssext}{\url{github.com/cfr42/nfssext}}%
190 }}
191 % \date{\fileversion~\filetoday}
192 \date{\fileversion~\filedate}
193 \pagestyle{fancy}
194 \fancyhf{}
195 \def\exfsdocffont{\itshape\plstyle\footnotesize}
196 \def\exfsdochfont{\itshape\plstyle}
197 %^^A \fancyhf[rh]{\itshape\plstyle\leftmark}
198 %^^A \fancyhf[lh]{\sffamily\plstyle\leftmark}
199 \fancyhf[rh]{\exfsdochfont\thepage}
200 \fancyhf[rf]{\exfsdocffont\fileversion}
201 % ^^A \fancyhf[rh]{\itshape\filetoday}
202 % ^^A \fancyhf[ch]{\itshape Support for Latin Modern}
203 % ^^A\fancyhf[lf]{\itshape\fileversion}
204 %^^A \fancyhf[cf]{\itshape\plstyle--- \thepage~/~\lastpage{} ---}
205 % ref. fancyhdr (or see tc3 ref'd there?)
206 \renewcommand \sectionmark[1]{\markboth{\thesection{} #1}{}}
207 \renewcommand \subsectionmark[1]{\markright{\arabic{subsection} #1}}
208 \ExplSyntaxOn
209 \fancyhf[lh]{\exfsdochfont\rlap{\nouppercase{\leftmark}}\skip_horizontal:n { \g__exfs_doc_offset_dim }\nouppercase{\rightmark}}
210 %^^A \fancyhf[lf]{\exfsdocffont\rlap{\filebase}\skip_horizontal:n { \g__exfs_doc_offset_dim }\fileversion }
211 \fancyhf[lf]{\exfsdocffont\filebase }
212 \hook_gput_code:nnn {shipout/lastpage} {.}
213 {
214 \property_record:nn {t:lastpage}{abspage,page,pagenum}
215 }
216 \cs_new_protected_nopar:Npn \lastpage
217 {
218 \property_ref:nn {t:lastpage}{page}
219 }
220 \cs_new_eq:NN \OrigMakePrivateLetters \MakePrivateLetters
221 \dim_new:N \g__exfs_doc_offset_dim
222 \hook_gput_code:nnn { begindocument } {.}
223 {
224 \dim_gset:Nn \g__exfs_doc_offset_dim { \marginparwidth + \marginparsep }
225 \fancyheadoffset[lh,lf]{ \g__exfs_doc_offset_dim }
226 }
227 \ExplSyntaxOff
228 \makeatletter
229 \def\@xobeysp{\leavevmode\penalty100\ }
230 \makeatother
231 \definecolor{strawberry}{rgb}{1.000,0.000,0.502}
232 \definecolor{blueberry}{rgb}{0.000,0.000,1.000}
233 \definecolor{moss}{rgb}{0.000,0.502,0.251}
234 \begin{document}
235 \let\MakePrivateLetters\MyMakePrivateLetters
236 \DocInput{\filename}
237 \end{document}
238 %</driver>
239 % \fi
240 %
241 % \changes{2008-10-26}{2008/10/26}{First public release as part of \lpack{cfr-lm}.}
242 % \changes{2008-12-22}{2008/12/22}{Updated version released standalone.}
243 % \changes{\svn 6140}{2017/03/28}{%
244 % Fixes a bug which prevented \cs{tmstyle} and \cs{tvstyle} working correctly if the current font was not a serif family.
245 % (Especially problematic in Beamer where \cs{normalfont} cannot be used as a workaround, but annoying elsewhere.)}
246 %
247 % \changes{\svn 6140}{2017/03/28}{%
248 % Provides something a bit closer to real documentation.%
249 % }
250 %
251 % \maketitle\thispagestyle{empty}
252 % \pdfinfo{%
253 % /Creator (TeX)
254 % /Producer (pdfTeX)
255 % /Author (Clea F.\ Rees)
256 % /Title (nfssext-cfr)
257 % /Subject (TeX)
258 % /Keywords (TeX,LaTeX,Clea,Rees)}
259 % \pdfcatalog{%
260 % /URL ()
261 % /PageMode /UseOutlines}
262 % \setlength{\parindent}{0pt}
263 % \setlength{\parskip}{0.5em}
264 %
265 %
266 % \begin{abstract}
267 %
268 % \noindent \lpack{nfssext-cfr} is an extension and modification of Philipp Lehman's \lpack{nfssext} which provides extended font selection commands modelled on those provided by \LaTeXe{}.
269 % Given an appropriate font configuration, \lpack{nfssext-cfr} enables users to change the weight, width, shape and style of font as easily as they can select bold, italic or typewriter.
270 % For instance, the package makes it trivial to use proportional, hanging figures in the body of the text, proportional, lining figures in captions and headers and tabular, lining figures in tables.
271 % An extensive choice of commands are provided to access a wide variety of weights, widths, shapes and styles from the more common (e.g.~semi-bold or condensed) to the less common (e.g.~‘outline’ and right or upright italic).
272 % Comprehensive support is provided for ‘swash’ and ‘alternate’ styles.
273 % These are implemented as families rather than shapes to support fonts which offer multiple swash shapes (e.g.~small-caps, italic and upright) or alternate styles.
274 % These may be used to provide effective access to fancy ligatures, end-of-word swashes etc.\ without sacrificing the range of characters provided by \textsc{t1}.
275 %
276 % The package also provides code to enable new font definition files, which may use \cs{DeclareEncodingSubset} as of the 2024-11-19 \LaTeX{} release, to be used with older versions of the format.
277 % For post-2020 versions of the format, the package supports these declarations; for older versions, the package provides an empty definition.
278 %
279 % The package is not primarily intended for direct use by end-users, but is designed rather to facilitate the creation of more sophisticated font support packages.
280 % End-users may nonetheless find the package useful, subject to the constraints explained in this document.
281 % Moreover, end-users may wish to pass options to the package on newer kernels, if loading font support packages which have not been updated for changes to font selection\footnote{‘Kernel’ refers to the \LaTeX{} kernel in this context and should not be confused with your system kernel.}.
282 %
283 % \end{abstract}
284 %
285 % \tableofcontents
286 %
287 % \listoftables
288 %
289 % \section{Introduction}\label{sec:intro}
290 %
291 %
292 % The package was originally a fairly simple extension of Philipp Lehman's \lpack{nfssext}\@.
293 % \lpack{nfssext} provides commands which enable one to specify font features not covered by the New Font Selection Scheme (\nfss).
294 % The package developed according to the needs of particular fonts I configured for \LaTeX{} and, in a few cases, my dissatisfaction with the original commands.
295 %
296 % In adapting the package for the (New) New Font Selection Scheme\footnote{%
297 % Officially, there is no such designation, but I have to call it something.
298 % Throughout this document and packages which depend upon it, I use this term to refer to the font selection features introduced into \LaTeX{} in 2020.%
299 % } (\nnfss), I have tried to balance \begin{enumerate*}[label=(\roman*)]\item backwards compatibility\footnote{%
300 % Note that 100\% backwards compatibility cannot be implemented on current \LaTeX{} kernels.%
301 % } for users loading updated font support packages, \item backwards compatibility for users loading packages which haven't been updated and \item compatibility with the new features of \nnfss{}\end{enumerate*}.
302 % I have also tried to account for the common case in which documents use combinations of fonts from different packages, each of which may or may not load \lpack{nfssext-cfr} and may or may not have been updated for \nnfss{}.
303 % This has inevitably required some compromises and there are certainly places where I would do things differently if starting from scratch.
304 %
305 % While I don't recommend installing this version of \lpack{nfssext-cfr} on an older system, the package should continue to work more-or-less as it always did on older kernels.
306 % To achieve this, the package is split into a main file, \file{nfssext-cfr.sty}, which provides common code and figures out whether to load code for \nfss{} (\file{nfssext-cfr-nfss.sty}) or \nnfss{} (\file{nfssext-sty-nnfss.sty}).
307 % \file{nfssext-cfr-nfss.sty} is essentially what was \file{nfssext-cfr.sty} minus the code retained in the latter.
308 %
309 % Unfortunately, tt is impossible to ensure 100\% backwards compatibility with recent \LaTeX{} kernels.
310 % By default, \lpack{nfssext-cfr} tries to interfere as little as possible with the kernel, even at the cost of backwards compatibility.
311 % If \texttt{compat} is enabled, however, the package does its best to enable backwards compatible behaviour, at the cost of the new functionality provided by the kernel.
312 %
313 % \lpack{nfssext-cfr} does not eschew interference with the kernel at all costs.
314 % Even without \texttt{compat} it patches or replaces some kernel code because some things just don't work sensibly\footnote{%
315 % This is true in two main places.
316 % The first is the kernel's initialisation of series at the start of the document.
317 % This overwrites the default \texttt{bf} series according to the font family name rather than the font name.
318 % This means that virtual fonts which depend on Computer or Latin Modern are not handled correctly and, because this code is delayed, the problem cannot be corrected by setting things up appropriately earlier.
319 %
320 % The second is the implementation of ‘swash’ which is by far the most problematic of the changes and one of the most difficult to navigate.
321 % It isn't clear to me how seriously the kernel's definition is intended to be, but I have chosen to overwrite the kernel code here.}.
322 %
323 % \begin{center}
324 % \fbox{%
325 % \begin{minipage}{.9\linewidth}
326 % \textbf{All font-support code should be updated to use \texttt{compat=false} when loading \lpack{nfssext-cfr}.}
327 % The changes in \nnfss{} \textbf{require} changes to code based on Philipp Lehman's Font Installation Guide.
328 % \end{minipage}}
329 % \end{center}
330 %
331 % \section{Macros}\label{sec:macros}
332 %
333 % \Cref{tab:smr,tab:srr,tab:wds,tab:wghts,tab:figs,tab:gen,tab:shapes} include macros supplied by the original \lpack{nfssext} and additions available with \lpack{nfssext-cfr}.
334 % Macros in \cref{tab:wds,tab:wghts,tab:shapes} should work with any font definition files which more-or-less adhere to \nfss/\nnfss.
335 % This should, theoretically, be all font packages but, in practice, things are rarely so simple.
336 % Macros in \cref{tab:figs,tab:gen} will work only with fonts named strictly according to the Berry naming scheme.
337 %
338 % In \cref{tab:wghts,tab:wds,tab:gen,tab:figs,tab:shapes}, the third column lists the default letter codes for various font features.
339 % If the defaults are changed, the macros will try to do something different.
340 %
341 % A \texttt{+} indicates that the macro will attempt to merge the addition into the current font's family name, series or shape.
342 % For example, if the current font uses oldstyle figures, the \texttt{+2} indicates that \cs{pstyle} will attempt to select a font with figures which are both proportional and oldstyle.
343 %
344 % A \texttt{-} indicates that the macro will attempt to subtract from the current font's family name, series or shape.
345 % For example, if the current font uses oldstyle figures, the \texttt{-2} indicates that \cs{tstyle} will attempt to select a font with figures which are both tabular and oldstyle.
346 %
347 % A comma-separated list indicates consecutive additions and/or subtraction.
348 %
349 % If no \texttt{+-} is used, the macro tries to select a font with the given feature without merging.
350 % For example \cs{sistyle} tries to switch to \texttt{si} shape regardless of the current font shape.
351 %
352 % A \texttt{--} indicates that the macro will try to clear all relevant letter codes from the current font's family name, series or shape.
353 % For example, \cs{regwidth} tries to switch to a series with no letter codes indicating non-standard widths in its name.
354 %
355 % Additions, subtractions and clearances operate on font family names, series or shapes, as appropriate.
356 % In general, macros with \texttt{style} in their names operate on family names; those with \texttt{shape} operate on shape codes\footnote{But \textbf{not} \cs{swshape}!}; and those with \texttt{width} or \texttt{weight} operate on series codes.
357 %
358 % The letter codes correspond to those specified by the \nfss{} specification, unless the specification does not include the relevant feature.
359 % In the latter case, I tried to choose something sensible i.e.~something which made sense to me at the time.
360 % These choices are not always those specified by the \nnfss{} specification, since sense and sensibility are sometimes in the eye of the encoder.
361 %
362 % \newcolumntype{T}{>{\ttfamily\tlstyle\arraybackslash}l}
363 % \newcolumntype{F}{>{\rmfamily\arraybackslash}l}
364 % \newcolumntype{R}{>{\rmfamily\arraybackslash}X}
365 % \begin{table}
366 % \centering
367 % \begin{threeparttable}
368 % \caption{Standard (kernel) macros (re)defined}\label{tab:smr}
369 % \begin{tabular}{lF}
370 % \toprule
371 % \cs{swshape}\tnotex{tn:sw-exists}\tnotex{tn:swshape-refs}\DescribeMacro[noprint]{\swshape} & redefined on new kernels\tnotex{tn:sw} \\
372 % & defined on old kernels \\
373 % \cs{itshape}\DescribeMacro[noprint]{\itshape} & old kernels only\\
374 % \cs{scshape}\DescribeMacro[noprint]{\scshape} & old kernels only\\
375 % \cs{upshape}\DescribeMacro[noprint]{\upshape} & old kernels only\\
376 % \cs{DeclareEncodingSubset}\DescribeMacro[noprint]{\DeclareEncodingSubset} & redefined on post-2020 pre-2024-11-19 kernels\tnotex{tn:des} \\
377 % & defined on old kernels\tnotex{tn:deso} \\
378 % \bottomrule
379 % \end{tabular}
380 % \begin{tablenotes}
381 % \item\label{tn:sw-exists}Defined only by newer kernels.
382 % \item\label{tn:swshape-refs}See \cref{tab:gen,tab:shapes} and text.
383 % \item\label{tn:sw}Definition depends on kernel, \texttt{force} and \texttt{compat}.
384 % \item\label{tn:des}The redefinition is done at the beginning of the document, so does not affect any use in \texttt{.sty} files.
385 % The change allows declarations to be used in font definition files, even if the format is older than the ‘hot fix’ provided in November 2024.
386 % \item\label{tn:deso}The definition is empty in this case.
387 % It enables older formats to use font definition files which include encoding declarations, but the information provided in such declarations is simply discarded.
388 % \end{tablenotes}
389 % \end{threeparttable}
390 % \end{table}
391 % \begin{table}
392 % \centering
393 % \caption{Standard (kernel) font change rules redefined}\label{tab:srr}
394 % \begin{tabular}{TTF}
395 % \toprule
396 % \multicolumn{2}{c}{Shape} & \\
397 % \multicolumn{1}{c}{Current} & \multicolumn{1}{c}{Requested} & \multicolumn{1}{c}{\sffamily Applied when?} \\
398 % \midrule
399 % it & sc & \texttt{compat} \& \nnfss{} only \\
400 % sl & sc & \texttt{compat} \& \nnfss{} only \\
401 % sc & it & \texttt{compat} \& \nnfss{} only \\
402 % sc & sl & \texttt{compat} \& \nnfss{} only \\
403 % scsl & it & \texttt{compat} \& \nnfss{} only \\
404 % \bottomrule
405 % \end{tabular}
406 % \end{table}
407 % \begin{table}
408 % \centering
409 % \begin{threeparttable}
410 % \caption{Family switches: general}\label{tab:gen}
411 % \begin{tabularx}\linewidth{llTR}
412 % \toprule
413 % \multicolumn{2}{c}{Macros} & \multicolumn{1}{c}{} & \\
414 % \multicolumn{1}{c}{Text Command} & \multicolumn{1}{c}{Switch} & \multicolumn{1}{c}{Family Code} & \sffamily Style \\
415 % \midrule
416 % \cs{textti}\DescribeMacro[noprint]{\textti} & \cs{tistyle}\DescribeMacro[noprint]{\tistyle} & +d & titling/display\\
417 % \cs{textlt}\tnotex{tn:cf-textlg}\DescribeMacro[noprint]{\textlt} & \cs{ltstyle}\tnotex{tn:cf-lgweight}\DescribeMacro[noprint]{\ltstyle} & +l & light if separate family \\
418 % \cs{textof}\DescribeMacro[noprint]{\textof} & \cs{ofstyle}\DescribeMacro[noprint]{\ofstyle} & +l & open-face (or outline or blank) style\\
419 % \cs{textalt}\DescribeMacro[noprint]{\textalt} & \cs{altstyle}\DescribeMacro[noprint]{\altstyle} & +a & alternative style\\
420 % \cs{textreg}\DescribeMacro[noprint]{\textreg} & \cs{regstyle}\DescribeMacro[noprint]{\regstyle} & -- & regular style\\
421 % \cs{emboss}\DescribeMacro[noprint]{\emboss} & \cs{embossstyle}\DescribeMacro[noprint]{\embossstyle} & +e & ‘embossed’ style \\
422 % \cs{textorn}\DescribeMacro[noprint]{\textorn} & \cs{ornamentalstyle}\DescribeMacro[noprint]{\ornamentalstyle} & +p & decorative initials etc.\\
423 % \cs{ornament}\DescribeMacro[noprint]{\ornament} & \\
424 % \cs{textqt}\DescribeMacro[noprint]{\textqt} & \cs{qtstyle}\DescribeMacro[noprint]{\qtstyle} & +q & quotation style\\
425 % \cs{textsh}\DescribeMacro[noprint]{\textsh} & \cs{shstyle}\DescribeMacro[noprint]{\shstyle} & +h & shadowed style\\
426 % \cs{texttm}\DescribeMacro[noprint]{\texttm} & \cs{tmstyle}\DescribeMacro[noprint]{\tmstyle} & -s,-v,+t & monowidth typewriter\\
427 % \cs{texttv}\DescribeMacro[noprint]{\texttv} & \cs{tvstyle}\DescribeMacro[noprint]{\tvstyle} & -s,-t,+v & variable width typewriter\\
428 % \cs{textswash}\DescribeMacro[noprint]{\textswash} & \cs{swashstyle}\tnotex{tn:cf-swstyle}\DescribeMacro[noprint]{\swashstyle} & +w & swash \\
429 % \cs{textsw}\tnotex{tn:swshape-not}\DescribeMacro[noprint]{\textsw} & \cs{swshape}\tnotex{tn:swshape-not}\DescribeMacro[noprint]{\swshape} && ‘find a route to swash’ \\
430 % \bottomrule
431 % \end{tabularx}
432 % \begin{tablenotes}
433 % \item\label{tn:cf-textlg}Cf.\ \cs{textlg} in \cref{tab:wghts}.
434 % \item\label{tn:cf-lgweight}Cf.\ \cs{lgweight} in \cref{tab:wghts}.
435 % \item\label{tn:cf-swstyle}Cf.\ \cs{swstyle} in \cref{tab:shapes}.
436 % \item\label{tn:swshape-not}Effect is kernel and option dependent, but potentially changes family and/or shape.
437 % ‘Tries to find a route to swash.’
438 % See text for an explanation of what, why and when.
439 % See \cref{sec:imp} for details of how.
440 % \end{tablenotes}
441 % \end{threeparttable}
442 % \end{table}
443 % \begin{table}
444 % \centering
445 % \begin{threeparttable}
446 % \caption{Family switches: figures}\label{tab:figs}
447 % \begin{tabular}{llTF}
448 % \toprule
449 % \multicolumn{2}{c}{Macros} & \multicolumn{1}{c}{} & \\
450 % \multicolumn{1}{c}{Text Command} & \multicolumn{1}{c}{Switch} & \multicolumn{1}{c}{Family Code} & \sffamily Style of Figures \\
451 % \midrule
452 % \cs{textln}\tnotex{tn:orig}\DescribeMacro[noprint]{\textln} & \cs{lnstyle}\tnotex{tn:orig}\DescribeMacro[noprint]{\lnstyle} & -- & lining (cf.~\cs{lstyle} below)\\
453 % \cs{textos}\tnotex{tn:orig}\DescribeMacro[noprint]{\textos} & \cs{osstyle}\tnotex{tn:orig}\DescribeMacro[noprint]{\osstyle} & j & oldstyle (cf.~\cs{ostyle} below)\\
454 % \cs{textinf}\DescribeMacro[noprint]{\textinf} & \cs{infstyle}\DescribeMacro[noprint]{\infstyle} & 0 & inferior \\
455 % & \cs{instyle}\DescribeMacro[noprint]{\instyle} & & \\
456 % \cs{textin}\DescribeDMacro[noprint]{\textin} & & & if \lpack{hyperref} is at least v7.01m or not loaded \\
457 % \cs{textsu}\DescribeMacro[noprint]{\textsu} & \cs{sustyle}\DescribeMacro[noprint]{\sustyle} & 1 & superior \\
458 % \cs{textl}\tnotex{tn:new}\DescribeMacro[noprint]{\textl} & \cs{lstyle}\tnotex{tn:new}\DescribeMacro[noprint]{\lstyle} & -j & lining (cf.~\cs{lnstyle} above)\\
459 % \cs{texto}\tnotex{tn:new}\DescribeMacro[noprint]{\texto} & \cs{ostyle}\tnotex{tn:new}\DescribeMacro[noprint]{\ostyle} & +j & oldstyle (cf.~\cs{osstyle} above)\\
460 % \cs{textp}\tnotex{tn:new}\DescribeMacro[noprint]{\textp} & \cs{pstyle}\tnotex{tn:new}\DescribeMacro[noprint]{\pstyle} & +2 & proportional \\
461 % \cs{textt}\tnotex{tn:new}\DescribeMacro[noprint]{\textt} & \cs{tstyle}\tnotex{tn:new}\DescribeMacro[noprint]{\tstyle} & -2 & tabular \\
462 % \cs{textpl}\tnotex{tn:both}\DescribeMacro[noprint]{\textpl} & \cs{plstyle}\tnotex{tn:both}\DescribeMacro[noprint]{\plstyle} & -j,+2 & proportional lining \\
463 % \cs{textpo}\tnotex{tn:both}\DescribeMacro[noprint]{\textpo} & \cs{postyle}\tnotex{tn:both}\DescribeMacro[noprint]{\postyle} & +2j & proportional oldstyle \\
464 % \cs{texttl}\tnotex{tn:both}\DescribeMacro[noprint]{\texttl} & \cs{tlstyle}\tnotex{tn:both}\DescribeMacro[noprint]{\tlstyle} & -j,-2 & tabular lining \\
465 % \cs{textto}\tnotex{tn:both}\DescribeMacro[noprint]{\textto} & \cs{tostyle}\tnotex{tn:both}\DescribeMacro[noprint]{\tostyle} & +j,-2 & tabular oldstyle \\
466 % \bottomrule
467 % \end{tabular}
468 % \begin{tablenotes}
469 % \item\label{tn:orig}This macro is the original \lpack{nfssext} command.
470 % The result is independent of the current style of figures.
471 % \item\label{tn:new}This macro changes precisely one aspect of the current figure style.
472 % That is, the result depends on the current style of figures.
473 % \item\label{tn:both}This macro ensures a specific fully-specified figure style.
474 % \end{tablenotes}
475 % \end{threeparttable}
476 % \end{table}
477 % \begin{table}
478 % \centering
479 % \begin{threeparttable}
480 % \caption{Shape switches}\label{tab:shapes}
481 % \begin{tabular}{llTF}
482 % \toprule
483 % \multicolumn{2}{c}{Macros} & \multicolumn{1}{c}{} & \\
484 % \multicolumn{1}{c}{Text Command} & \multicolumn{1}{c}{Switch} & \multicolumn{1}{c}{Shape Code} & \sffamily Shape \\
485 % \midrule
486 % -- & \cs{scolshape}\DescribeMacro[noprint]{\scolshape} & scol & outline small-caps \\
487 % \cs{textol}\DescribeMacro[noprint]{\textol} & \cs{olshape}\DescribeMacro[noprint]{\olshape} & ol & outline\\
488 % \cs{textsi}\DescribeMacro[noprint]{\textsi} & \cs{sishape}\DescribeMacro[noprint]{\sishape} & si & italic small-caps\\
489 % \cs{textu}\DescribeMacro[noprint]{\textu} & \cs{ushape}\DescribeMacro[noprint]{\ushape} & u & ?? \\
490 % \cs{textscu}\DescribeMacro[noprint]{\textscu} & \cs{scushape}\DescribeMacro[noprint]{\scushape} & su & ?? \\
491 % \cs{textui}\DescribeMacro[noprint]{\textui} & \cs{uishape}\DescribeMacro[noprint]{\uishape} & ui & upright italic\\
492 % \cs{textri}\DescribeMacro[noprint]{\textri} & \cs{rishape}\DescribeMacro[noprint]{\rishape} & ri & reverse italic\\
493 % \cs{textdf}\DescribeMacro[noprint]{\textdf} & \cs{dfshape}\DescribeMacro[noprint]{\dfshape} & n & default shape\\
494 % -- & \cs{swstyle}\tnotex{tn:cf-swashstyle}\DescribeMacro[noprint]{\swstyle} & +w,it & swash family \emph{and} shape \\
495 % \cs{textsw}\tnotex{tn:cf-textswash}\tnotex{tn:cf-swshape-not-shape}\DescribeMacro[noprint]{\textsw} & \cs{swshape}\tnotex{tn:cf-swshape-not-shape}\DescribeMacro[noprint]{\swshape} && ‘find a route to swash’ \\
496 % \bottomrule
497 % \end{tabular}
498 % \begin{tablenotes}
499 % \item\label{tn:cf-textswash}Cf.~\cs{textswash} in \cref{tab:gen}.
500 % \item\label{tn:cf-swashstyle}Cf.~\cs{swashstyle} in \cref{tab:gen}.
501 % \item\label{tn:cf-swshape-not-shape}Definition is kernel and option dependent, but probably doesn't (just) change shape.
502 % See \cref{tab:gen} for sketch and text for details.
503 % \end{tablenotes}
504 % \end{threeparttable}
505 % \end{table}
506 % \begin{table}
507 % \centering
508 % \caption{Series switches: widths}\label{tab:wds}
509 % \begin{tabular}{llTF}
510 % \toprule
511 % \multicolumn{2}{c}{Macros} & \multicolumn{1}{c}{} & \\
512 % \multicolumn{1}{c}{Text Command} & \multicolumn{1}{c}{Switch} & \multicolumn{1}{c}{Series Code} & \sffamily Width \\
513 % \midrule
514 % \cs{textnw}\DescribeMacro[noprint]{\textnw} & \cs{nwwidth}\DescribeMacro[noprint]{\nwwidth} & +c & narrow \\
515 % \cs{textcd}\DescribeMacro[noprint]{\textcd} & \cs{cdwidth}\DescribeMacro[noprint]{\cdwidth} & +c & compact \\
516 % \cs{textec}\DescribeMacro[noprint]{\textec} & \cs{ecwidth}\DescribeMacro[noprint]{\ecwidth} & +ec & extra compact \\
517 % \cs{textuc}\DescribeMacro[noprint]{\textuc} & \cs{ucwidth}\DescribeMacro[noprint]{\ucwidth} & +uc & ultra compact \\
518 % -- & \cs{mdwidth}\DescribeMacro[noprint]{\mdwidth} & +?m & medium \\
519 % \cs{textet}\DescribeMacro[noprint]{\textet} & \cs{etwidth}\DescribeMacro[noprint]{\etwidth} & +x & extended \\
520 % \cs{textep}\DescribeMacro[noprint]{\textep} & \cs{epwidth}\DescribeMacro[noprint]{\epwidth} & +x & expanded \\
521 % \cs{textex}\DescribeMacro[noprint]{\textex} & \cs{exwidth}\DescribeMacro[noprint]{\exwidth} & +ex & extra expanded \\
522 % \cs{textux}\DescribeMacro[noprint]{\textux} & \cs{uxwidth}\DescribeMacro[noprint]{\uxwidth} & +ux & ultra expanded \\
523 % \cs{textrw}\DescribeMacro[noprint]{\textrw} & \cs{regwidth}\DescribeMacro[noprint]{\regwidth} & -- & regular \\
524 % \bottomrule
525 % \end{tabular}
526 % \end{table}
527 % \begin{table}
528 % \centering
529 % \begin{threeparttable}
530 % \caption{Series switches: weights}\label{tab:wghts}
531 % \begin{tabular}{llTF}
532 % \toprule
533 % \multicolumn{2}{c}{Macros} & \multicolumn{1}{c}{} & \\
534 % \multicolumn{1}{c}{Text Command} & \multicolumn{1}{c}{Switch} & \multicolumn{1}{c}{Series Code} & Weight \\
535 % \midrule
536 % -- & \cs{mdweight}\DescribeMacro[noprint]{\mdweight} & +m? & medium \\
537 % \cs{textmb}\DescribeMacro[noprint]{\textmb} & \cs{mbweight}\DescribeMacro[noprint]{\mbweight} & +mb & medium-bold \\
538 % \cs{textdb}\DescribeMacro[noprint]{\textdb} & \cs{dbweight}\DescribeMacro[noprint]{\dbweight} & +db & demi-bold \\
539 % \cs{textsb}\DescribeMacro[noprint]{\textsb} & \cs{sbweight}\DescribeMacro[noprint]{\sbweight} & +sb & semi-bold \\
540 % \cs{textbd}\DescribeMacro[noprint]{\textbd} & \cs{bdweight}\DescribeMacro[noprint]{\bdweight} & +b & bold \\
541 % & \cs{bfweight}\DescribeMacro[noprint]{\bfweight} & & \\
542 % \cs{texteb}\DescribeMacro[noprint]{\texteb} & \cs{ebweight}\DescribeMacro[noprint]{\ebweight} & +eb & extra-bold \\
543 % \cs{textub}\DescribeMacro[noprint]{\textub} & \cs{ubweight}\DescribeMacro[noprint]{\ubweight} & +ub & ultra-bold \\
544 % \cs{textlg}\tnotex{tn:cf-textlt}\DescribeMacro[noprint]{\textlg} & \cs{lgweight}\tnotex{tn:cf-ltstyle}\DescribeMacro[noprint]{\lgweight} & +l & light when weight \\
545 % \cs{textel}\DescribeMacro[noprint]{\textel} & \cs{elweight}\DescribeMacro[noprint]{\elweight} & +el & extra-light \\
546 % \cs{textul}\DescribeMacro[noprint]{\textul} & \cs{ulweight}\DescribeMacro[noprint]{\ulweight} & +ul & ultra-light \\
547 % \bottomrule
548 % \end{tabular}
549 % \begin{tablenotes}
550 % \item\label{tn:cf-textlt}Cf.\ \cs{textlt} in \cref{tab:gen}.
551 % \item\label{tn:cf-ltstyle}Cf.\ \cs{ltstyle} in \cref{tab:gen}.
552 % \end{tablenotes}
553 % \end{threeparttable}
554 % \end{table}
555 %
556 % One further macro is available, though it has no effect on older kernels.
557 %
558 % \DescribeMacro{\nfssextset}\marg{key-value list}
559 %
560 % Package options (see \cref{sec:nkern} may also be specified after loading either in the preamble (\texttt{compat} and \texttt{force}) or at any time (\texttt{debug}).
561 % This enables users to set options after some other package loads \lpack{nfssext-cfr} and allows additional information to be printed to the console and/or logged on local basis.
562 %
563 % \iffalse
564 %^^A \section{Applications}
565 %^^A
566 %^^A \lpack{nfssext-cfr} may be used by any font support package which supports fonts named according to the Berry scheme and uses compatible settings in its font definition files.
567 %^^A
568 %^^A In general, the package does little or nothing to extend support for arbitrary fonts.
569 %^^A If your favourite font's support package doesn't do what you want, it is highly unlikely loading this package will help.
570 %^^A There is usually no reason to load the package in documents, because any package requiring it should explicitly load it as a dependency.
571 %^^A
572 %^^A However, due to complications resulting from recent changes to \LaTeX's \nfss{} in \nnfss, those using current (or even moderately recent) versions of \LaTeX{} \emph{may} need to pass the package options as explained below.
573 %^^A
574 %^^A Furthermore, \lpack{nfssext-cfr} may be useful if you are using a font support package which provides an option to load, say, light and semi-bold in place of regular/medium and bold.
575 %^^A If the package does not allow you to use more than two weights in a single document, loading \lpack{nfssext-cfr} should allow you to access the otherwise inaccessible weights.
576 %^^A
577 %^^A The same principle works for widths: if the package allows you to choose between, say, condensed and regular width at load time, but doesn't provide commands to switch in the document itself, \lpack{nfssext-cfr} may enable you to access the full range of widths.
578 %^^A
579 %^^A The same would apply to a package which offered, say, a choice of standard, reverse and/or upright italics, but did not allow you to switch between them.
580 %^^A I'm not aware of any such package, but \lpack{nfssext-cfr} could be useful if such exists.
581 %^^A
582 %^^A However, this principle does \textbf{not} extend to the style of figures, use of swash or choice of alternate ligatures etc\@.
583 %^^A If your preferred font support package offers you a choice of proportional/tabular and/or hanging/lining figures, but provides no means to switch between them, \lpack{nfssext-cfr} is unlikely to help unless the package happens to use Berry naming\footnote{%
584 %^^A Most packages don't.
585 %^^A In particular, packages which use \texttt{autoinst} do not generally use Berry names.}.
586 %^^A
587 % \fi
588 %
589 %
590 % \section{Newer \LaTeX{} Kernels}\label{sec:nkern}
591 %
592 % The package tests for the presence of \cs{init@series@setup}.
593 % If this exists, it loads a newer version of the package.
594 % \lpack{nfssext-cfr} supports three options, but these are only effective if the newer code (for \nnfss) is loaded.
595 % All three are booleans, initially false and default to true if used without specifying a value\footnote{%
596 % ‘Default’ and ‘initial’ follow the usage in \file{l3interface.pdf}, \lpack{l3keys2e} and \file{clsguide.pdf}.
597 % If you are familiar with \lpack{pgfkeys}, the terms have the same meaning there.
598 % Basically, the ‘initial’ value is what you get if you don't specify the option at all when loading the package, while the ‘default’ is what you get if you specify the option without specifying a value.
599 %
600 % ‘Scope’ is used in the standard sense applicable to \LaTeXe{} class and package options.
601 % That is, it indicates whether the option may be used only when loading the package, at any point in the preamble or also in the document.%
602 % }.
603 % The third option is described in \cref{sec:trafferth}.
604 %
605 % \DescribeOpt{force}\vals{true,false}
606 %
607 % Default: \texttt{true}
608 %
609 % Initial: \texttt{false}
610 %
611 % Scope: preamble
612 %
613 % You can force the old code to be loaded using the package option \texttt{force} or \texttt{force=true}.
614 % Note, however, that the old version will not work as advertised on newer kernels because \LaTeX{} will overwrite some of the package's definitions at the end of the preamble.
615 %
616 % \DescribeOpt{compat}\vals{true,false}
617 %
618 % Default: \texttt{true}
619 %
620 % Initial: \texttt{false}
621 %
622 % Scope: preamble
623 %
624 % In contrast, \texttt{compat} or \texttt{compat=true} will activate code which tries to partially replicate the original \lpack{nfssext-cfr}'s behaviour.
625 % This is far from unproblematic.
626 % In particular, it will partly break features of the current \nfss{} for other fonts.
627 %
628 % If your document relies exclusively on text fonts supported by this package and none of the support for those fonts has been updated, compilation should produce a more satisfactory result than otherwise.
629 % If, however, your document relies partly on text fonts not supported by this package or the support for those fonts has been updated in the ‘wrong’ way, compilation may produce a less satisfactory result.
630 % There is no general rule here: whether the option helps or hinders things depends entirely on the fonts, the support for those fonts and the specific contents of your document.
631 %
632 % The main areas known to be problematic are
633 % \begin{enumerate}
634 % \item\label{enum:si} italic small-capitals (but oblique small-capitals should be mostly unaffected);
635 % \item\label{enum:swash} swash;
636 % \item\label{enum:it} transitions between small-caps, italic, oblique, italic small-caps, oblique small-caps, upright italic, right italic and upright;
637 % \item\label{enum:swshape} any transition involving swash where shape is involved;
638 % \item\label{enum:m} medium weight fonts where width is non-standard e.g.~medium condensed, medium ultra condensed etc.;
639 % \item\label{enum:mb} medium bold weight in any context.
640 % \end{enumerate}
641 % \ref{enum:si}--\ref{enum:swshape} can be worked around at the document level, with some inconvenience.
642 % Subject to the caveats above, the \texttt{compat} option may avoid at least some of these inconveniences.
643 %
644 % \ref{enum:m} and \ref{enum:mb} cannot be worked around at the document level.
645 % Nor does \lpack{nfssext-cfr} make any attempt to mitigate these two issues.
646 % Doing so would involve too much interference with current \nnfss{}.
647 % This means that \ref{enum:m} and \ref{enum:mb} can be addressed only in the support files for the fonts affected.
648 % Neither \texttt{compat} nor \texttt{force} makes any attempt to change this.
649 %
650 % Maximum backwards compatibility requires changes to the font support files \emph{and} \texttt{compat=false}, but some documents may still require (hopefully minor) changes.
651 %
652 % \subsection{Required Changes to Font Support Files}\label{subsec:fsf}
653 %
654 % \textbf{In all cases, additional changes to font substitution rules may be needed to prevent multiple substitutions by the same font, since these seem to cause problems.}
655 %
656 % \begin{description}
657 % \item[italic small-caps] The problem here is that \lpack{nfssext} encoded italic small-caps as shape \texttt{si}, whereas the kernel has plumped for \texttt{scit}.
658 % It does support \texttt{scsl} (although it does not distinguish oblique from italic), but not \texttt{si}.
659 % This issue can be more-or-less dealt with by support files for fonts, but some issues arise at the document level concerning transitions (below).
660 %
661 % Ideally, \texttt{scit} should be substituted wherever font definition files specify the shape \texttt{si}.
662 % \texttt{scit} should then be defined as a (silent) substitution for \texttt{si}.
663 % However, it \emph{should} be sufficient to define \texttt{si} as a substitute for \texttt{scit}.
664 %
665 % Fonts which provide oblique small-caps, but not italic, should specify \texttt{scsl} as a (silent) substitution for \texttt{scit} and \texttt{scit} for \texttt{si} (or \emph{vice-versa}).
666 % The kernel supports \texttt{scsl} out-of-the-box, together with the substitution for \texttt{scit}, but the changes should make support for \cs{textsi} and \cs{sishape} more robust.
667 % \item[transitions] \textbf{No additional changes are recommended to support files which load \lpack{nfssext-cfr}.}
668 % Provided \texttt{fd} files are updated as explained above, no further adjustments should be required to enable correct font selection during transitions involving italic, oblique, small-caps, upright italic, reverse italic etc\@.
669 %
670 % \item[swash] \textbf{No changes are recommended for swash to font definition files for packages which load \lpack{nfssext-cfr}.}
671 % If loading \lpack{nfssext-cfr}, the recommendation is to \textbf{ignore} the kernel's implementation because it cannot be made to work correctly with any family which provides swash for multiple shapes e.g.~both upright and italic or small-caps and upper/lower case\footnote{%
672 % The issue here is that the kernel considers swash to be a \emph{shape}, whereas \lpack{nfssext} only \emph{called} it a shape.
673 % The underlying code treated it as a \emph{style} requiring a change of font \emph{family}.
674 % The shape was always (potentially switched to) italic (\texttt{it}).
675 % \lpack{nfssext-cfr} offered a second version of swash, which treats it as a family possibly requiring a change of shape, but the shape is typically italic or upright, as opposed to being specific to swash.
676 %
677 % To make things worse, not all fonts \emph{can} be setup in the way the kernel assumes because some fonts provide swash characters in a variety of shapes (upright and italic, for example).
678 % Moreover, it is common to encode additional ligatures, for example, as swash, even though this is not accurate, in order to provide \emph{some} mechanism for accessing them within a traditional 8-bit font setup.%
679 % }.
680 %
681 % \item[swshape] \textbf{No changes for swash are recommended for \texttt{sty} files in packages which load \lpack{nfssext-cfr}.}
682 %
683 % \lpack{nfssext-cfr-nfss} contains the original \lpack{nfssext} definition of \cs{swshape} and \cs{textsw}.
684 % This is used on newer kernels only if \texttt{force} is used, in which case the code is largely broken.
685 %
686 % \lpack{nfssext-cfr-nnfss} contains both the original definition and a replacement.
687 % The former is used only if \texttt{compat} is selected; otherwise, the latter is used on kernels supporting \nnfss.
688 % The new definition tries to figure out which of the three possible implementations, if any, to use and behaves accordingly.
689 % \textbf{The kernel definition is overwritten regardless.}
690 % \texttt{compat} determines only \emph{what} overwrites the kernel's.
691 % \item[medium] Any line of a font definition file which codes a series of two or more letters including \texttt{m} must be changed to delete the \texttt{m}.
692 % For example, \texttt{\{mc\}} \textrightarrow{} \texttt{\{c\}}, \texttt{\{muc\}} \textrightarrow{} \texttt{\{uc\}} etc\@.
693 % \textbf{It is NOT sufficient to substitute such series using rules.}
694 % The changes \textbf{must} be made in the primary definitions of the font families.
695 % \item[mb] I've chosen to make \cs{mbweight} an alias for \cs{sbweight}.
696 % Hopefully no font family supports both.
697 % Provided that's not the case, \texttt{mb} should be changed to \cs{sb} in all affected font definition files.
698 % \textbf{It is NOT sufficient to substitute \texttt{mb} for \texttt{sb} using a rule.}
699 % The change \textbf{must} be made in the definition of the family.
700 % \end{description}
701 %
702 %
703 % \section{Older \LaTeX{} Kernels}\label{sec:okern}
704 %
705 % This is the code base \lpack{nfssext} was written for.
706 % \lpack{nfssext-cfr} extended that code.
707 %
708 % To the best of my knowledge, the code used with older \LaTeX{} kernels works as expected.
709 % This means it is fully compatible with the Font Installation Guide and that things like \texttt{\textbackslash scshape \textbackslash itshape} will produce italic small-caps, as expected.
710 % This code is also --- again to the best of my knowledge --- fully compatible with all features of \nfss{} with the single exception of code supporting medium weight, condensed width fonts which erroneously uses \texttt{mc} rather than \texttt{c}.
711 %
712 % Italic small-caps is assumed to be coded as \texttt{si}.
713 % Oblique small-caps is assumed to be coded as \texttt{scsl}.
714 %
715 % If a set of fonts provides a swash \emph{family}, it is assumed the fonts are named in accordance with the Berry scheme.
716 % \cs{textswash}, \cs{swshape}, \cs{swashstyle} and/or \cs{swstyle} can then be used to access this family.
717 %
718 % The difference between \cs{swashstyle} and \cs{swstyle} is that the former tries to merge any swash family with the current one, whereas the latter does not.
719 % So, if a font set provides swash for two widths of font, say, and you've changed widths, \cs{swashstyle} will try to find a swash character without altering the width, whereas \cs{swstyle} will first switch to the base font, resetting the width.
720 % On the other hand, if the font only provides swash in the standard width, say, and you've changed widths, \cs{swashstyle} will fail to switch to swash, whereas \cs{swstyle} will succeed.
721 % Packages which include swash families should, therefore, advise users which command(s) to use.
722 %
723 % \cs{textswash} is the text font command for \cs{swashstyle}.
724 % \cs{textsw} is the text font command for \cs{swshape}.
725 %
726 % \cs{swshape} first tries \cs{swstyle} before changing the shape to \cs{swshapedefault}.
727 % By default, this is \cs{itdefault} because swash families are often coded as italic, but this is obviously font-dependant.
728 %
729 % \section{Bugs, Non-Bugs \& Debugging}\label{sec:trafferth}
730 %
731 % The actual effect of any macro depends on any changes made to the defaults for various font features, the current font and, of course, what is available.
732 %
733 %^^A For example, \cs{itdefault} is intended to be the name of italic shape and is used by the redefined \cs{itshape} supplied by this package for older kernels.
734 %^^A By default, \cs{itdefault} is \texttt{it}.
735 %^^A However, if you change that to, say, \texttt{sl}, then \cs{itshape} will use \texttt{sl} instead.
736 %^^A Note that changing \cs{itdefault} will have no effect on newer kernels.
737 %^^A
738 %^^A Moreover, if the current shape is small-caps, \cs{itshape} will attempt to merge the default italic shape with the small-caps on older kernels.
739 %^^A That is, it will try to select small-caps italic, if possible, before resorting to plain italic.
740 %^^A On newer kernels, this attempt is builtin for a limited range of shape and series changes.
741 %^^A
742 % The macros operating on family names are almost entirely reliant on font names adhering strictly to the Karl Berry schema.
743 % This includes the stipulation that multiple variants be listed in alphabetical order.
744 % These macros cannot be used with fonts named in any other way.
745 %
746 %^^A Although font definition files \emph{should} adhere to the series and shape codes specified by \nfss{}, some do not.
747 %^^A In particular, some newer packages prepared with \texttt{autoinst} use descriptive, but non-standard, codes.
748 %^^A While these work fine if the packages provide comprehensive access to the series and shapes they support, they otherwise require bespoke solutions if extensions are required.
749 %^^A
750 %^^A Provided font definition files do adhere to the standard encoding conventions, however, macros for changing weight, width and shape in \lpack{nfssext-cfr} should work fine on newer kernels (\nnfss).
751 % On older kernels (\nfss), changes to weight and width should work and most shapes should be supported, but italic small-caps is assumed to be coded as \texttt{si} on these kernels, so you may need something like
752 % \iffalse
753 %<*verb>
754 % \fi
755 % \begin{verbatim}
756 \renewcommand*{\sidefault}{scit}% or scsl or whatever
757 % \end{verbatim}
758 % \iffalse
759 %</verb>
760 % \fi
761 % On newer kernels, italic small-caps should be encoded as explained above and \cs{sishape}/\cs{textsi} should work out-of-the-box with packages which use any of \texttt{si}, \texttt{scit} or \texttt{scsl}.
762 %
763 % If a macro's attempt to enable or disable a font feature fails, a warning will generally be written to the console, but the code tries hard not to trigger errors.
764 % If an attempt triggers an error, that's a bug, so please let me know.
765 % If an attempt triggers a warning, please note that there may be no bug at all and, if there is a bug, it is probably not in this package\footnote{%
766 % To be clear, there certainly are bugs.
767 % It is just statistically unlikely that any given warning is caused by one.}
768 %
769 % \DescribeOpt{debug}\vals{true,false}
770 %
771 % Default: \texttt{true}
772 %
773 % Initial: \texttt{false}
774 %
775 % Scope: general
776 %
777 % You can get a bit more information printed to the console about what's happening using this option on newer kernels.
778 % Some of the same information can also be found in the log.
779 %
780 % \changes{v6140}{2017-03-28}{%
781 % Extend documentation somewhat.}
782 %
783 % \changes{2010-07-17}{2015-06-19}{%
784 % There should be no changes for the end user except that in certain cases it is possible that line-breaks may be altered if \lpack{microtype} is in use due to the enhanced support included for variant font families.}
785 %
786 % \MaybeStop{%
787 % \PrintChanges
788 % \setcounter{IndexColumns}{2}%
789 % \PrintIndex
790 % }
791 %
792 % \section{Implementation}\label{sec:imp}
793 %
794 % You do not need to read the remainder of this document in order to install or use the package.
795 %
796 % \subsection{Main package file}\label{subsec:main}
797 %
798 % This used to be the complete package.
799 % Now it is mostly responsible for processing options, figuring out which kernel we're on and implementing the small amount of code shared between the implementations for \nfss{} and \nnfss{}.
800 %
801 % \iffalse
802 %<*sty>
803 % \fi
804 % \begin{package}{nfssext-cfr}
805 % \begin{macrocode}
806 \NeedsTeXFormat{LaTeX2e}
807 \RequirePackage{svn-prov}
808 \ProvidesPackageSVN[\filebase.sty]{$Id: nfssext-cfr.dtx 11042 2025-06-22 22:34:34Z cfrees $}[v1.3 \revinfo{} extensions for NFSS and NNFSS; based on 2003/03/14 v1.2 Experimental NFSS Extensions]
809 \DefineFileInfoSVN
810 % \end{macrocode}
811 % ^^A Paid â defnyddio \GetFileInfoSVN*/\GetFileInfoSVN{} yn y fan hon!!
812 %
813 % ^^A Is there really no more manageable way of coping with different versions of the format?
814 % ^^A How does lpt manage this?!!
815 %
816 % \changes{v0.0}{2020-2024}{Update for \nnfss.}
817 %
818 % \changes{v1.0}{2024-09-16}{%
819 % So \lpack{nfssext-cfr} merging is now limited to family, weight and width.}
820 %^^A I *could* use font change rules for weight and width - this would make sense if I could be confident of catching all cases *and* it didn't cause problems ....
821 %^^A the real problem is, I don't know what I'm supposed to avoid ....
822 %
823 % \changes{v1.0}{2024-09-16}{%
824 % Behaviour depends on kernel version and options.
825 % On newer kernels, quite conservative/less compatible by default.
826 % Fully compatible on older kernels.}
827 %
828 % \changes{v1.0}{2024-09-16}{Split \file{nfssext-cfr.sty} into \file{nfssext-cfr\{,-nfss,-nnfss\}.sty}.}
829 %
830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
832 % \begin{macro}{\if@nfssextcfr@digonnew}
833 % \mbox{ }
834 % \begin{macrocode}
835 \newif\if@nfssextcfr@digonnew
836 % \end{macrocode}
837 % \end{macro}
838 % \begin{macrocode}
839 \@nfssextcfr@digonnewtrue
840 % \end{macrocode}
841 % Copied verbatim, excepting format and modulo package/module name from Joseph Wright's \file{siunitx.sty} under LPPL
842 % \begin{macrocode}
843 \@ifundefined{ExplLoaderFileDate}{%
844 \IfFileExists{expl3.sty}{%
845 \RequirePackage{expl3}%
846 }{%
847 \RequirePackage{nfssext-cfr-nfss}%
848 \@nfssextcfr@digonnewfalse
849 }%
850 }{}
851 \if@nfssextcfr@digonnew
852 % \end{macrocode}
853 % Almost verbatim from \file{siunitx.sty}
854 % \begin{macrocode}
855 \@ifl@t@r\ExplLoaderFileDate{2022-02-24}{%
856 }{%
857 \RequirePackage{nfssext-cfr-nfss}%
858 \@nfssextcfr@digonnewfalse
859 }%
860 \fi
861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
862 \if@nfssextcfr@digonnew
863 % \end{macrocode}
864 % BEGIN expl pkg option setup
865 % \begin{macrocode}
866 \newif\ifexfs@debug
867 \ExplSyntaxOn
868 \prop_gput:Nnn \g_msg_module_name_prop { nfssext-cfr } { exfs }
869 \bool_new:N \l__exfs_tmpa_bool
870 \keys_define:nn { exfs }
871 {
872 % \end{macrocode}
873 % \begin{option}{compat}
874 % \changes{v1.0}{2024-09-16}{%
875 % Add option \texttt{compat}.
876 % More aggressive/backwards compatible with \texttt{compat}.}
877 % \begin{macro}{\g__exfs_compat_bool}
878 % Compatibility option.
879 % \begin{macrocode}
880 compat .bool_gset:N = \g__exfs_compat_bool,
881 compat .default:n = true,
882 compat .initial:n = false,
883 compat .usage:n = preamble,
884 % \end{macrocode}
885 % \end{macro}
886 % \end{option}
887 % \begin{option}{debug}
888 % Turns info messages into warnings for testing purposes and possibly provides additional information.
889 % \changes{v1.0}{2024-09-16}{%
890 % Add option \texttt{debug}.}
891 % \begin{macrocode}
892 debug .legacy_if_gset:n = exfs@debug,
893 debug .initial:n = false,
894 debug .default:n = true,
895 % \end{macrocode}
896 % \end{option}
897 % \begin{option}{force}
898 % \changes{v1.0}{2024-09-16}{%
899 % Add option \texttt{force}.
900 % Load old file/incompatible with \texttt{force}.}
901 % \begin{macro}{\g__exfs_force_bool}
902 % Force loading of code for \nfss{} even on newer kernels.
903 % \begin{macrocode}
904 force .bool_gset:N = \g__exfs_force_bool,
905 force .default:n = true,
906 force .initial:n = false,
907 force .usage:n = preamble,
908 % \end{macrocode}
909 % \end{macro}
910 % \end{option}
911 % \begin{macrocode}
912 }
913 % \end{macrocode}
914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
915 % Joseph Wright: from \file{siunitx.sty} ; \url{https://chat.stackexchange.com/transcript/message/64327823#64327823}
916 % \begin{macrocode}
917 \providecommand \IfFormatAtLeastTF { \@ifl@t@r \fmtversion }
918 \IfFormatAtLeastTF { 2022-06-01 }
919 {
920 \ProcessKeyOptions [ exfs ]
921 }{
922 \RequirePackage { l3keys2e }
923 \ProcessKeysOptions { exfs }
924 % \end{macrocode}
925 % \begin{macro}{\ProcessKeyOptions}
926 % \mbox{ }
927 % \begin{macrocode}
928 \NewDocumentCommand \ProcessKeyOptions { o }
929 {
930 \IfValueTF { #1 } { \ProcessKeysOptions { #1 } }
931 { \PackageError{nfssext-cfr}{
932 Optional~argument~mandatory~on~kernels~this~old.\MessageBreak
933 Please~specify~the~module~whose~keys~should~be~processed
934 }{
935 \protect\ProcessKeyOptions~only~passes~keys~to~
936 \protect\ProcessKeyOptions\MessageBreak
937 on~older~kernels~for~the~convenience~of~package~authors.~
938 Since~\protect\ProcessKeysOptions\MessageBreak
939 takes~an~argument,~the~optional~argument~to~
940 \protect\ProcessKeyOptions~is~required
941 }
942 }
943 }
944 % \end{macrocode}
945 % \end{macro}
946 % \begin{macrocode}
947 }
948 \IfFormatAtLeastTF { 2020-10-01 }{
949 }{
950 \RequirePackage { xparse }
951 % \end{macrocode}
952 % \begin{macro}{\ExpandArgs}
953 % \mbox{ }
954 % \begin{macrocode}
955 \providecommand \ExpandArgs [1]
956 { \cs_if_exist_use:c { exp_args:N #1 } }
957 % \end{macrocode}
958 % \end{macro}
959 % \begin{macrocode}
960 }
961 % \end{macrocode}
962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
963 % END expl pkg option setup
964 %
965 % BEGIN cfr-added: bifurcate
966 %
967 % We test for the presence of \cs{init@series@setup} in order to determine whether to load code for \nnfss{} or \nfss.
968 % If \texttt{force} is set, we load for \nfss{} regardless.
969 % \begin{macrocode}
970 \RequirePackage{etoolbox}
971 \msg_new:nnn { nfssext-cfr } { compat }
972 {
973 You ~ or ~ a ~ font-support ~ package ~ have ~ loaded ~ me ~ ( line ~ \msg_line_number: ) ~ with ~ the ~ compat ~ option. ~
974 This ~ means ~ the ~ package ~ may ~ require ~ updating. ~
975 Update ~ the ~ package ~ if ~ necessary ~ and ~ use ~ compat=false ~ when ~ loading ~ me.
976 }
977 \msg_new:nnn { nfssext-cfr } { force }
978 {
979 You ~ or ~ a ~ font-support ~ package ~ have ~ loaded ~ me ~ ( line ~ \msg_line_number: ) ~ with ~ the ~ force ~ option. ~
980 This ~ is ~ a ~ desperate ~ measure ~ of ~ last ~ resort. ~
981 **Breakage ~ is ~ expected.**
982 }
983 \hook_gput_code:nnn { begindocument/before } { . }
984 {
985 \cs_if_exist:NTF \init@series@setup
986 {
987 \bool_if:NTF \g__exfs_force_bool
988 {
989 \msg_warning:nn { nfssext-cfr } { force }
990 \RequirePackage {nfssext-cfr-nfss}
991 }{
992 \bool_if:NT \g__exfs_compat_bool
993 {
994 \msg_warning:nn { nfssext-cfr } { compat }
995 }
996 \RequirePackage {nfssext-cfr-nnfss}
997 }
998 }{% achosiad heb broblemau - diolch byth!
999 \RequirePackage {nfssext-cfr-nfss}
1000 }
1001 }
1002 % \end{macrocode}
1003 % \changes{v1.2}{2025-01-03}{Workaround to allow use of encoding subset declarations in font definition files, even if somebody tries to use a font package with an older format.}
1004 % This code is here to enable backwards-compatible encoding declarations in font definition files.
1005 % We have three cases: \begin{enumerate*}[label=(\arabic*)]\item the format predates \nnfss{}, in which case the commands probably don't exist at all, \item the format is recent enough for \nnfss{} but predates the November 2024 ‘hotfix’ release (2024-11-19), in which case the commands will return errors after the preamble and \item the format is at least as new as the ‘hotfix’, in which case the macros' definitions should be fine\end{enumerate*}.
1006 % This requires we check whether \emph{both} the format is no older than 2024-11-01 \emph{and} the patch level is at least 1\footnote{^^A
1007 % At least, it seems to, though it also seems there ought to be a more straightforward way to check what is essentially the release date or version?^^A
1008 % }.
1009 %
1010 % In this third case, we do nothing.
1011 % \begin{macrocode}
1012 \bool_set_false:N \l__exfs_tmpa_bool
1013 \IfFormatAtLeastT { 2024-11-01 }
1014 {
1015 \ifnum\patch@level>0
1016 \bool_set_true:N \l__exfs_tmpa_bool
1017 \fi
1018 }
1019 \bool_if:NF \l__exfs_tmpa_bool
1020 {
1021 \cs_if_free:NTF \DeclareEncodingSubset
1022 {
1023 % \end{macrocode}
1024 % \begin{macro}{\DeclareEncodingSubset}
1025 % If the macro isn't even defined in the preamble, define it to absorb three arguments.
1026 % \begin{macrocode}
1027 \def\DeclareEncodingSubset#1#2#3{}
1028 }{
1029 % \end{macrocode}
1030 % \begin{macro}{\@DeclareEncodingSubset@copi}
1031 % Otherwise, we save the preamble definition of the innermost definition on ‘in between’ kernels.
1032 % \begin{macrocode}
1033 \let\@DeclareEncodingSubset@copi\@DeclareEncodingSubset
1034 % \end{macrocode}
1035 % \end{macro}
1036 % \begin{macrocode}
1037 \hook_gput_code:nnn { begindocument / end } { . }
1038 {
1039 % \end{macrocode}
1040 % Simpler than the kernel version because we're only interested in use inside \file{fd} files.
1041 % If the declarations are in \file{sty} files, it doesn't matter what definitions are in place inside the document environment.
1042 %
1043 % \textbf{Note the syntax differs from the kernel/preamble version.}
1044 % The macro expects three arguments, but the star syntax is \textbf{not} supported as it makes no sense in font definition files, which are family-specific.
1045 % \begin{macrocode}
1046 \let\DeclareEncodingSubset\@DeclareEncodingSubset@copi
1047 \PackageWarning{nfssext-cfr}{Overwriting ~ the ~ format's ~ definition ~ of ~ \string\DeclareEncodingSubset{} }
1048 % \end{macrocode}
1049 % \end{macro}
1050 % \begin{macrocode}
1051 }
1052 }
1053 }
1054 % \end{macrocode}
1055 % \begin{macro}{\__exfs_set:n}
1056 % \begin{macrocode}
1057 \cs_new_protected_nopar:Nn \__exfs_set:n
1058 {
1059 \keys_set:nn { exfs } { #1 }
1060 }
1061 % \end{macrocode}
1062 % \end{macro}
1063 % \begin{macro}{\nfssextset}
1064 % Allow setting of options later in preamble or in document.
1065 % This is intended to enable debugging to be toggled locally.
1066 % \begin{macrocode}
1067 \cs_set_eq:NN \nfssextset \__exfs_set:n
1068 % \end{macrocode}
1069 % \end{macro}
1070 % \begin{macrocode}
1071 \ExplSyntaxOff
1072 % \end{macrocode}
1073 % END added
1074 % \begin{macro}{\DeclareTextOrnament,\ornament}
1075 % These are unmodified from \lpack{nfssext}.
1076 % I'm not aware of any \ctan{} packages using these and they have not been tested for compatibility with \nnfss{}, though I can't see any patently obvious problems.
1077 % \begin{macrocode}
1078 \newcommand*{\DeclareTextOrnament}[7]{%
1079 \expandafter\def\csname#1@orn\@roman#2\endcsname{#3/#4/#5/#6/#7}}
1080 \begingroup
1081 \catcode`\/=12
1082 \gdef\exfs@split@orndef#1/#2/#3/#4/#5\@nil{%
1083 \def\f@encoding{#1}%
1084 \def\f@family{#2}%
1085 \def\f@series{#3}%
1086 \def\f@shape{#4}%
1087 \def\exfs@tempa{#5}}
1088 \endgroup
1089 \def\exfs@base@family{\expandafter\exfs@get@base\f@family\@nil}
1090 \DeclareRobustCommand{\ornament}[1]{%
1091 \expandafter\ifx\csname\exfs@base@family @orn\@roman#1\endcsname\relax
1092 \PackageWarning{nfssext}{%
1093 Ornament #1 undefined for font family '\exfs@base@family'\MessageBreak
1094 Setting debug mark}%
1095 \rule{1ex}{1ex}%
1096 \else
1097 \begingroup
1098 \edef\exfs@tempb{\csname\exfs@base@family @orn\@roman#1\endcsname}%
1099 \expandafter\expandafter\expandafter\exfs@split@orndef
1100 \expandafter\string\exfs@tempb\@nil
1101 \selectfont\char\exfs@tempa
1102 \endgroup
1103 \fi}
1104 % \end{macrocode}
1105 % \end{macro}
1106 % \begin{macro}{\nfssextcfr@MT@Hook,\Microtype@Hook}
1107 % BEGIN add \lpack{microtype} hooks
1108 % Partly from \lpack{microtype} docs; partly from \lpack{MinionPro} package
1109 % \changes{2010-07-17}{2015/06/19}{%
1110 % Add \lpack{microtype} support for variants.}
1111 % \begin{macrocode}
1112 \def\nfssextcfr@MT@Hook{%
1113 % \end{macrocode}
1114 %^^A \DeclareMicrotypeVariants{x,j,w,a,d,0,1}% this is the default declaration according to the docs
1115 %^^A \DeclareMicrotypeVariants*{2,e,h,l}% this should *append* the variants (what do I use 'f' for? better take it out...)
1116 % \begin{macrocode}
1117 \DeclareMicrotypeVariants*{2,2d,2dj,2j,dj,e,h,l}% is this necessary or would the previous line be enough?
1118 }
1119 \@ifpackageloaded{microtype}{%
1120 \PackageWarning{nfssext-cfr}{%
1121 You have loaded me (or a font support package which loads me)\MessageBreak
1122 after loading microtype, but microtype should be loaded after\MessageBreak
1123 all font defaults have been setup}%
1124 \nfssextcfr@MT@Hook
1125 }{%
1126 \@ifundefined{Microtype@Hook}{%
1127 \let\Microtype@Hook\nfssextcfr@MT@Hook
1128 }{% MinionPro has \global before this
1129 \g@addto@macro\Microtype@Hook{\nfssextcfr@MT@Hook}%
1130 }%
1131 }
1132 % \end{macrocode}
1133 % \end{macro}
1134 % \changes{v1.1}{2024-10-03}{Fix grouping cock up.}
1135 % \begin{macrocode}
1136 \fi
1137 % END
1138 % \end{macrocode}
1139 % \end{package}
1140 % \iffalse
1141 %</sty>
1142 % \fi
1143 %
1144 % \subsection{NNFSS}\label{subsec:sty-nnfss}
1145 %
1146 %
1147 % This code was written for the \emph{current} (New) New Font Selection Scheme (2020--).
1148 % It should not generally be loaded on older kernels.
1149 %
1150 %
1151 % \iffalse
1152 %<*sty-nnfss>
1153 % \fi
1154 % \begin{package}{nfssext-cfr-nnfss}
1155 % \begin{macrocode}
1156 \NeedsTeXFormat{LaTeX2e}
1157 \RequirePackage{svn-prov}
1158 \ProvidesPackageSVN[\filebase-nnfss.sty]{$Id: nfssext-cfr.dtx 11042 2025-06-22 22:34:34Z cfrees $}[v1.3 \revinfo{} extended New New Font Selection Scheme (NNFSS) based on 2003/03/14 v1.2 Experimental NFSS Extensions]
1159 \DefineFileInfoSVN
1160 % \end{macrocode}
1161 % ^^A Paid â defnyddio \GetFileInfoSVN*/\GetFileInfoSVN{} yn y fan hon!!
1162 % END added
1163 % \begin{macro}{\exfs@tempa,\exfs@tempb,\exfs@tempf}
1164 % Scratch variables.
1165 % \begin{macrocode}
1166 \newcommand*{\exfs@tempa}{}
1167 \newcommand*{\exfs@tempb}{}
1168 % \end{macrocode}
1169 %:end-added
1170 % BEGIN added (cfr): extra variable (\cs{exfs@tempf})
1171 % \begin{macrocode}
1172 \newcommand*{\exfs@tempf}{}
1173 % \end{macrocode}
1174 % \end{macro}
1175 % We want to track cases where missing fonts get defined into existence.
1176 % To do this we define an additional macro each time \cs{wrong@fontshape} is called.
1177 % This is based on two proposals by Max Chernoff, but the implementation is different.
1178 % \begin{macrocode}
1179 \ExplSyntaxOn
1180 \hook_gput_code:nnn { cmd/wrong@fontshape/before } { . }
1181 {
1182 \global\expandafter\expandafter\expandafter\let
1183 \expandafter \csname exfs@fake@ \curr@fontshape\endcsname\relax
1184 }
1185 \ExplSyntaxOff
1186 % \end{macrocode}
1187 % \begin{macro}{\exfs@info}
1188 % Custom logging
1189 % \begin{macrocode}
1190 \newcommand \exfs@info[2][nfssext-cfr]{%
1191 \ifexfs@debug
1192 \PackageWarning{#1}{Info: #2}%
1193 \else
1194 \PackageInfo{#1}{#2}%
1195 \fi
1196 }
1197 % \end{macrocode}
1198 % \end{macro}
1199 % END added
1200 %
1201 % \begin{macro}{\exfs@normalise}
1202 % BEGIN added (cfr): normalise
1203 % \begin{macrocode}
1204 \newcommand* \exfs@normalise[1]{%
1205 \ifcsname exfs@fake@\curr@fontshape\endcsname
1206 \exfs@info{Current font '\curr@fontshape' is fake.\MessageBreak
1207 Normalising}%
1208 \expandafter\csname f@#1\endcsname{\csname #1default\endcsname}\selectfont
1209 \ifcsname exfs@fake@\curr@fontshape\endcsname
1210 \f@series{\seriesdefault}\f@shape{\shapedefault}\selectfont
1211 \ifcsname exfs@fake@\curr@fontshape\endcsname
1212 % \end{macrocode}
1213 % This might happen, I think, if we're in a swash family or specialist encoding
1214 % where the default series and shape aren't available.
1215 % All bets are off here so try to bale out as gracefully as we can.
1216 % \begin{macrocode}
1217 \normalfont
1218 \ifcsname exfs@fake@\curr@fontshape\endcsname
1219 % \end{macrocode}
1220 % This definitely oughtn't to happen, though - things are really screwed up at
1221 % this point - so error.
1222 % \begin{macrocode}
1223 \PackageError{nfssext-cfr}{Default font appears to be fake!\MessageBreak
1224 Switch \textbackslash normalfont yielded '\curr@fontshape'}
1225 {This is highly unlikely, so the bug is probably in the phenomena\MessageBreak
1226 rather than the noumena}%
1227 \fi
1228 \fi
1229 \fi
1230 \exfs@info{Normalised to '\curr@fontshape'}%
1231 \else
1232 \exfs@info{Current font '\curr@fontshape' appears real}%
1233 \fi
1234 }
1235 % \end{macrocode}
1236 % END added
1237 % \end{macro}
1238 %
1239 % \begin{macro}{\exfs@try@family}
1240 % Modified from \lpack{nfssext}?
1241 % Or modified from older \lpack{nfssext-cfr}?
1242 % \begin{macrocode}
1243 \newcommand*{\exfs@try@family}[2][]{%
1244 \let\exfs@tempa\relax
1245 % \end{macrocode}
1246 % END added
1247 %
1248 % trans: group is requisite here else \LaTeX{} thinks the family real regardless
1249 % \begin{macrocode}
1250 \begingroup % fel arall, bydd latex yn credu bod y family yn go iawn beth bynnag
1251 % \end{macrocode}
1252 % (o leiaf bydd latex yn dweud felly)
1253 % \begin{macrocode}
1254 \exfs@info{Trying Font family '\f@encoding/#2'}%
1255 \fontfamily{#2}\try@load@fontshape
1256 % \end{macrocode}
1257 % \cs{curr@fontshape} holds the target shape - not the current one - after an unsuccessful attempt to load **family** with \cs{try@load@fontshape}.
1258 % This won't work for series/shape as \cs{curr@fontshape} holds the current one in that case
1259 % \begin{macrocode}
1260 \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1261 \edef\exfs@tempa{#1}%
1262 \ifx\exfs@tempa\@empty
1263 \PackageWarning{nfssext}{%
1264 Font family '\f@encoding/#2' not available\MessageBreak
1265 Ignoring font switch}%
1266 \else
1267 \exfs@info[nfssext]{%
1268 Font family '\f@encoding/#2' not available\MessageBreak
1269 Font family '\f@encoding/#1' tried instead}%
1270 \exfs@try@family{#1}%
1271 \fi
1272 \else
1273 \exfs@info{Loading font family '\f@encoding/#2'}%
1274 \gdef\exfs@tempa{\fontfamily{#2}\selectfont}%
1275 \fi
1276 \endgroup
1277 \exfs@tempa}
1278 % \end{macrocode}
1279 % \end{macro}
1280 % \begin{macro}{\exfs@try@series}
1281 % BEGIN added (cfr)
1282 % \begin{macrocode}
1283 \newcommand*{\exfs@try@series}[2][]{%
1284 % \end{macrocode}
1285 % We don't hand instructions to the kernel unless we know they'll succeed b/c the results are too unpredictable under \nnfss.
1286 %
1287 % Changing directly only produces usable results for series defined in the 'table' of font changes.
1288 % But using higher level kernel interfaces for tests doesn't work because spurious fonts get defined, which only seem to exist.
1289 % Theoretically, we might as well use the existing kernel's macros since we're already damned by reliance on internals anyway.
1290 % But then everything needs disentangling.
1291 % So it's easier to just adapt previous tests, even though it partially duplicates what the kernel does.
1292 % (But it isn't the mess swash is \dots).
1293 % \begin{macrocode}
1294 \let\exfs@targetseries\relax
1295 \edef\exfs@tempa{#2}%
1296 \ifx\f@series\exfs@tempa\relax
1297 \exfs@info{Current (\f@series) matches target (#2) series.\MessageBreak
1298 Ignoring font switch}%
1299 \else
1300 \begingroup
1301 \exfs@normalise{series}%
1302 \edef\exfs@tempa{\f@encoding/\f@family/#2/\f@shape}%
1303 \ifcsname \exfs@tempa\endcsname
1304 \exfs@info{Switching series: \f@series\space -> #2}%
1305 \gdef\exfs@targetseries{\fontseries{#2}\selectfont}%
1306 \else
1307 \edef\exfs@reserved{#1}%
1308 \ifx\exfs@reserved\@empty
1309 \PackageWarning{nfssext-cfr}{%
1310 Font series '\f@encoding/\f@family/#2/\f@shape' not available\MessageBreak
1311 Ignoring font change}%
1312 \else
1313 \PackageWarning{nfssext-cfr}{%
1314 Font series '\f@encoding/\f@family/#2/\f@shape' not available\MessageBreak
1315 Trying '\f@encoding/\f@family/#1/\f@shape'}%
1316 \exfs@try@series{#1}%
1317 \fi
1318 \fi
1319 \endgroup
1320 \exfs@targetseries
1321 \fi}
1322 % \end{macrocode}
1323 % \end{macro}
1324 %^^A \newcommand*{\exfs@try@shape}[2][]{%
1325 %^^A Shapes are where the real problems start ....
1326 %^^A \let\exfs@targetshape\relax
1327 %^^A \edef\exfs@tempa{#2}%
1328 %^^A \ifx\f@shape\exfs@tempa\relax
1329 %^^A \\exfs@info{Current (\f@shape) matches target (#2) shape.\MessageBreak
1330 %^^A Ignoring font switch}%
1331 %^^A \else
1332 %^^A \begingroup
1333 %^^A \edef\exfs@tempa{\f@encoding/\f@family/\f@series/#2}%
1334 %^^A \ifcsname \exfs@tempa\endcsname
1335 %^^A \exfs@info{Switching shape: \f@shape\space -> #2}%
1336 %^^A \gdef\exfs@targetshape{\fontshape{#2}\selectfont}%
1337 %^^A \else
1338 %^^A \begingroup
1339 %^^A \exfs@normalise{shape}%
1340 %^^A \ifcsname \exfs@tempa\endcsname
1341 %^^A \exfs@info{Switching shape: \f@shape\space -> #2}%
1342 %^^A \gdef\exfs@targetshape{\exfs@normalise{shape}\fontshape{#2}\selectfont}%
1343 %^^A \endgroup
1344 %^^A \else
1345 %^^A \edef\exfs@reserved{#1}%
1346 %^^A \ifx\exfs@reserved\@empty
1347 %^^A \PackageWarning{nfssext-cfr}{%
1348 %^^A Font shape '\f@encoding/\f@family/\f@series/#2' not available\MessageBreak
1349 %^^A Ignoring font change}%
1350 %^^A \else
1351 %^^A \PackageWarning{nfssext-cfr}{%
1352 %^^A Font shape '\f@encoding/\f@family/\f@series/#2' not available\MessageBreak
1353 %^^A Trying '\f@encoding/\f@family/\f@series/#1'}%
1354 %^^A \exfs@try@shape{#1}%
1355 %^^A \fi
1356 %^^A \fi
1357 %^^A \fi
1358 %^^A \fi
1359 %^^A \endgroup
1360 %^^A \exfs@targetshape
1361 %^^A \fi}
1362 % \begin{macro}{\exfs@try@shapeshift}
1363 % Attempt to leverage kernel's mechanism.
1364 % \begin{macrocode}
1365 \def\exfs@try@shapeshift#1{%
1366 \edef\exfs@targetshape{\csname #1default\endcsname}%
1367 \ifx\f@shape\exfs@targetshape\relax
1368 \exfs@info{Current (\f@shape) matches target (#1) shape.\MessageBreak
1369 Ignoring font switch}%
1370 \else
1371 \not@math@alphabet\edef\exfs@targetshape\relax
1372 \exfs@info{\f@shape\space -> \exfs@targetshape\MessageBreak
1373 Trying \f@encoding/\f@family/\f@series/\exfs@targetshape}%
1374 % \end{macrocode}
1375 % We \emph{do} want the kernel's substitution mechanism here?
1376 % \begin{macrocode}
1377 \fontshape{\exfs@targetshape}\selectfont
1378 \fi}
1379 % \end{macrocode}
1380 % \end{macro}
1381 % \begin{macro}{\exfs@swshape}
1382 % Switching to swash is now far more complicated with (I presume) the attendant overhead, but the kernel's approach just won't work here\footnote{%
1383 % Implementing swash as a \emph{shape} isn't workable for fonts I've packaged, so I've made no attempt to follow the kernel here as I do for small-caps italic etc\@.
1384 % We're back to the single axis/multiple aspect problem which \nfss{} created by ignoring small-caps/italic and width/weight combinations.
1385 % It may, in fact, be wrong-headed to follow the kernel \emph{at all} here.
1386 % Perhaps it would be better to just provide the original implementation and some compatibility option for people who also need swash shapes in the same document?%
1387 % }.
1388 % This will become \cs{swshape} if \texttt{compat} isn't enabled.
1389 % \begin{macrocode}
1390 \newcommand* \exfs@swshape{%
1391 \let\exfs@targetsw\relax
1392 \begingroup % angen neu beidio? angen - bendant!
1393 % \end{macrocode}
1394 % Try kernel or configured default first so we get swash from current family etc.\ if available
1395 % \begin{macrocode}
1396 \edef\exfs@tempa{\f@encoding/\f@family/\f@series/\swdefault}%
1397 \edef\exfs@tempa@fake{exfs@fake@\exfs@tempa}%
1398 \ifcsname \exfs@tempa\endcsname
1399 \ifcsname exfs@fake@\exfs@tempa\endcsname
1400 \exfs@swfamily
1401 \else
1402 \gdef\exfs@targetsw{\fontshape{\swdefault}\selectfont}% kernel
1403 \fi
1404 \else
1405 \exfs@swfamily
1406 \fi
1407 \endgroup
1408 \ifx\exfs@targetsw\relax
1409 \PackageWarning{nfssext-cfr}{%
1410 Cannot find any route to swash.\MessageBreak
1411 Are you sure one is available?}%
1412 \else
1413 \exfs@targetsw
1414 \exfs@info{Switch to swash resulted in '\curr@fontshape'}%
1415 \fi
1416 }
1417 % \end{macrocode}
1418 % \end{macro}
1419 % \begin{macro}{\exfs@swfamily}
1420 % This is the guts of \cs{exfs@swshape}.
1421 % \begin{macrocode}
1422 \newcommand* \exfs@swfamily{%
1423 \let\exfs@targetsw\relax
1424 \begingroup
1425 % \end{macrocode}
1426 % ^^A \expandafter\ifx\csname\curr@fontshape\endcsname\relax
1427 % Try \lpack{nfssext-cfr} family switch \& our default or configured
1428 % \begin{macrocode}
1429 \let\exfs@tempa\f@family
1430 \exfs@merge@families{w}%
1431 \ifx\exfs@tempa\f@family % try merge with current shape
1432 % \end{macrocode}
1433 % Try switching to upright etc.\ first
1434 % \begin{macrocode}
1435 \fontshape{n}%
1436 \exfs@merge@families{w}% up & merge
1437 \if\exfs@tempa\f@family
1438 % \end{macrocode}
1439 % Try switching to \cs{swshapedefault}{} first
1440 % \begin{macrocode}
1441 \fontshape\swshapedefault
1442 \exfs@merge@families{w}% up & nfssext-cfr default/configured
1443 \if\exfs@tempa\f@family
1444 % \end{macrocode}
1445 % Use \lpack{nfssext} family switch \& default or configured
1446 % \begin{macrocode}
1447 \exf@try@family{\expandafter\exfs@get@base\f@family\@nil w}% nfssext switch
1448 \if\exfs@tempa\f@family % nfssext switch
1449 \fontshape\swshapedefault\exfs@try@family{%
1450 \expandafter\exfs@get@base\f@family\@nil w}% nfssext switch & shape
1451 \if\exfs@tempa\f@family
1452 \relax % rhodd y ffidl yn y to (give up)
1453 \else
1454 \gdef\exfs@targetsw{%
1455 \fontshape\swshapedefault\expandafter\fontfamily{%
1456 \exfs@get@base\f@family\@nil w}\selectfont
1457 }% nfssext switch & shape
1458 \fi % nfssext switch & shape
1459 \else
1460 \gdef\exfs@targetsw{\expandafter\fontfamily{%
1461 \exfs@get@base\f@family\@nil w}\selectfont
1462 }% nfssext switch
1463 \fi % nfssext switch
1464 \else
1465 \gdef\exfs@targetsw{%
1466 \fontshape\swshapedefault\exfs@merge@families{w}%
1467 }% up & nfssext-cfr default/configured
1468 \fi % up & nfssext-cfr default/configured
1469 \else
1470 \gdef\exfs@targetsw{%
1471 \fontshape{n}\exfs@merge@families{w}%
1472 }% up & merge
1473 \fi % up & merge
1474 \else
1475 \gdef\exfs@targetsw{\exfs@merge@families{w}}% merge with current shape
1476 \fi % merge with current shape
1477 \endgroup
1478 }
1479 % \end{macrocode}
1480 % \end{macro}
1481 % END added
1482 %
1483 % \begin{macro}{\exfs@get@base,\exfs@get@variants,\exfs@next,\exfs@shift,\exfs@first,\exfs@part,\exfs@second}
1484 % Utlities
1485 % \begin{macrocode}
1486 \def\exfs@get@base#1#2#3#4\@nil{#1#2#3}
1487 % \end{macrocode}
1488 % BEGIN added (cfr): more \cs{exfs@} commands (\texttt{get@variants}, \texttt{next}, \texttt{shift}, \texttt{first}, \texttt{part}, \texttt{second})
1489 % \begin{macrocode}
1490 \def\exfs@get@variants#1#2#3#4\@nil{#4}
1491 \def\exfs@next#1#2\@nil{#1}
1492 \def\exfs@shift#1#2\@nil{#2}
1493 \def\exfs@first#1#2\@nil{#1}
1494 \def\exfs@part#1#2\@nil{#2}
1495 \def\exfs@second#1#2#3\@nil{#2}
1496 % \end{macrocode}
1497 % \end{macro}
1498 % \begin{macro}{\exfs@series@splitter}
1499 % Common method for dealing with weight and width.
1500 % \changes{v1.0}{2024-09-16}{%
1501 % Rewritten as kernel no longer supports erroneous \texttt{m}.}
1502 % \begin{macrocode}
1503 \def\exfs@series@splitter#1{%
1504 \edef\exfs@weight{\expandafter\exfs@first#1\@nil}%
1505 \edef\exfs@width{\expandafter\exfs@shift#1\@nil}%
1506 % \end{macrocode}
1507 % Two char width only or two char weight
1508 % \begin{macrocode}
1509 \if\exfs@weight u\exfs@check@cx{u}%
1510 \else\if\exfs@weight e\exfs@check@cx{e}%
1511 \else\if\exfs@weight s\exfs@check@cx{s}%
1512 \else\if\exfs@weight d\exfs@check@cx{d}%
1513 \else\ifx\exfs@width\@empty % m dealt with elsewhere
1514 % \end{macrocode}
1515 % Single character width
1516 % \begin{macrocode}
1517 \if\exfs@weight c\def\exfs@width{c}\let\exfs@weight\@empty
1518 \else\if\exfs@weight x\def\exfs@width{x}\let\exfs@weight\@empty
1519 \fi\fi
1520 \fi\fi\fi\fi\fi
1521 \exfs@info{#1 -> \exfs@weight:\exfs@width;}%
1522 }
1523 % \end{macrocode}
1524 % \end{macro}
1525 % \begin{macro}{\exfs@check@cx}
1526 % Auxiliary for \cs{exfs@check@cx}
1527 % \begin{macrocode}
1528 \def\exfs@check@cx#1{%
1529 \edef\exfs@tempa{\expandafter\exfs@first\exfs@width\@nil}%
1530 \if\exfs@tempa c\edef\exfs@width{#1c}\let\exfs@weight\@empty
1531 \else\if\exfs@tempa x\edef\exfs@width{#1x}\let\exfs@weight\@empty
1532 \else\edef\exfs@weighta{%
1533 \exfs@weight\exfs@tempa
1534 }\let\exfs@weight\exfs@weighta
1535 \edef\exfs@widtha{%
1536 \expandafter\exfs@shift\exfs@width\@nil
1537 }\let\exfs@width\exfs@widtha
1538 \fi\fi
1539 }
1540 % \end{macrocode}
1541 % \end{macro}
1542 % END added
1543 %
1544 % \begin{macro}{\lnstyle,\osstyle,\infstyle,\instyle,\sustyle,\swstyle}
1545 % Unmodified from \lpack{nfssext}.
1546 % Anniffiniedig -> undefined in the kernel.
1547 % \begin{macrocode}
1548 \DeclareRobustCommand{\lnstyle}{%% anniffiniedig
1549 \not@math@alphabet\lnstyle\relax
1550 \exfs@try@family[\expandafter\exfs@get@base\f@family\@nil]%
1551 {\expandafter\exfs@get@base\f@family\@nil x}}
1552 \DeclareRobustCommand{\osstyle}{%% anniffiniedig
1553 \not@math@alphabet\osstyle\relax
1554 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil j}}
1555 \DeclareRobustCommand{\instyle}{%% anniffiniedig
1556 \not@math@alphabet\instyle\relax
1557 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 0}}
1558 \let\infstyle\instyle
1559 \DeclareRobustCommand{\sustyle}{%% anniffiniedig
1560 \not@math@alphabet\sustyle\relax
1561 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 1}}
1562 \DeclareRobustCommand{\swstyle}{%% anniffiniedig
1563 \not@math@alphabet\swstyle\relax
1564 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil w}}
1565 % \end{macrocode}
1566 % \end{macro}
1567 % BEGIN added (cfr) - merge families.
1568 %
1569 % \nnfss{} (unsurprisingly) does nothing here, so this is unproblematic.
1570 % The following depends **absolutely** on **complete** adherence to berry names.
1571 %
1572 % \begin{macro}{\ifexfs@added,\exfs@merge@families}
1573 % \cs{exfs@merge@families} is used in the macros recommended for switching the style of figures, activating swash and other variants etc.
1574 % \begin{macrocode}
1575 \newif\ifexfs@added
1576 \newcommand*\exfs@merge@families[1]{%
1577 \edef\exfs@vartomerge{#1}%
1578 \edef\exfs@variants{\expandafter\exfs@get@variants\f@family\@nil}%
1579 \exfs@info{Trying to merge variants #1 and \exfs@variants}%
1580 \edef\tempo{2j}%
1581 \let\exfs@tempq\@empty
1582 \def\exfs@tempg{}%
1583 \exfs@addedfalse
1584 % \end{macrocode}
1585 % Check whether there are variants - if not just use the requested addition.
1586 % \begin{macrocode}
1587 \ifx\exfs@variants\@empty
1588 \edef\exfs@tempq{\exfs@vartomerge}%
1589 \exfs@addedtrue
1590 \else
1591 \gdef\set{0,1,2,a,d,e,f,h,j,l,p,q,s,t,v,w}% these are the variants to consider - the order here and in the font name is crucial
1592 \ifx\tempo\exfs@vartomerge
1593 \@for \xx:=\set \do {%
1594 % \end{macrocode}
1595 % Check whether there are variants left - if not set the ‘next variant’ to empty
1596 % \begin{macrocode}
1597 \ifx\exfs@variants\@empty
1598 \let\exfs@nextvariant\@empty
1599 \else
1600 % \end{macrocode}
1601 % O/w get the next variant
1602 % \begin{macrocode}
1603 \edef\exfs@nextvariant{\expandafter\exfs@next\exfs@variants\@nil}%
1604 \fi
1605 % \end{macrocode}
1606 %^^A \edef\tempt{2}%
1607 %^^A \edef\tempj{j}%
1608 % If the next variant is 2 or j, ignore it
1609 % \begin{macrocode}
1610 \if\exfs@nextvariant 2%
1611 \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
1612 \fi
1613 \if\exfs@nextvariant j% if the next variant is j, ignore it
1614 \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
1615 \fi
1616 % \end{macrocode}
1617 % See if the current value is either 2 or j and add it if so and if needed
1618 % \begin{macrocode}
1619 \if\xx 2%
1620 \edef\exfs@tempg{\exfs@tempg\xx}%
1621 \else
1622 \if\xx j% if the current value is j, we're done
1623 \edef\exfs@tempq{\exfs@tempg\xx\exfs@variants}%
1624 \let\exfs@variants\@empty
1625 \exfs@addedtrue
1626 \else
1627 % \end{macrocode}
1628 % o/w see if the current value matches the next variant
1629 % \begin{macrocode}
1630 \ifx\xx\exfs@nextvariant
1631 \edef\exfs@tempg{\exfs@tempg\xx}%
1632 \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
1633 \fi
1634 \fi
1635 \fi
1636 }%
1637 \else
1638 \@for \xx:=\set \do {%
1639 % \end{macrocode}
1640 % Check whether there are variants left and, if not, add the addition if needed
1641 % \begin{macrocode}
1642 \ifx\exfs@variants\@empty
1643 \ifexfs@added
1644 \else
1645 \edef\exfs@tempq{\exfs@tempg\exfs@vartomerge}%
1646 \exfs@addedtrue
1647 \fi
1648 \else
1649 % \end{macrocode}
1650 % o/w get the next variant
1651 % \begin{macrocode}
1652 \edef\exfs@nextvariant{\expandafter\exfs@next\exfs@variants\@nil}%
1653 % \end{macrocode}
1654 % If the new token equals the next variant, combine whatever is saved in \cs{exfs@tempg} with whatever remains in \cs{exfs@variants}
1655 % \begin{macrocode}
1656 \ifx\exfs@nextvariant\exfs@vartomerge
1657 \edef\exfs@tempq{\exfs@tempg\exfs@variants}%
1658 \exfs@addedtrue
1659 \let\exfs@variants\@empty
1660 \else
1661 % \end{macrocode}
1662 % o/w, if the current value matches the requested addition, add it in
1663 % \begin{macrocode}
1664 \ifx\exfs@vartomerge\xx
1665 \edef\exfs@tempq{\exfs@tempg\xx\exfs@variants}%
1666 \exfs@addedtrue
1667 \let\exfs@variants\@empty
1668 \else
1669 % \end{macrocode}
1670 % o/w, if the current value matches the next variant, shift
1671 % \begin{macrocode}
1672 \ifx\exfs@nextvariant\xx
1673 \edef\exfs@tempg{\exfs@tempg\xx}%
1674 \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
1675 \fi
1676 \fi
1677 \fi
1678 \fi
1679 }%
1680 \fi
1681 \fi
1682 \ifx\exfs@tempq\@empty
1683 \PackageError{nfssext-cfr}{Something is wrong here. Ignoring font switching command.}{}%
1684 \else
1685 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
1686 \fi
1687 }
1688 % \end{macrocode}
1689 % \end{macro}
1690 % \begin{macro}{\pstyle,\ostyle,\postyle}
1691 % Commands for switching to proportional and/or oldstyle figures.
1692 % Compare \cs{ostyle} with \lpack{nfssext}'s \cs{osstyle} above.
1693 % These macros (and the block which follows) all require merging Berry names but not unmerging.
1694 % \begin{macrocode}
1695 \DeclareRobustCommand{\pstyle}{%% anniffiniedig proportional figures
1696 \not@math@alphabet\pstyle\relax
1697 \exfs@merge@families{2}}
1698 \DeclareRobustCommand{\ostyle}{%% anniffiniedig oldstyle figures (cf. original osstyle above)
1699 \not@math@alphabet\ostyle\relax
1700 \exfs@merge@families{j}}
1701 % \end{macrocode}
1702 % Combined command for proportional oldstyle
1703 % \begin{macrocode}
1704 \DeclareRobustCommand{\postyle}{%% anniffiniedig
1705 \not@math@alphabet\postyle\relax
1706 \exfs@merge@families{2j}}
1707 % \end{macrocode}
1708 % \end{macro}
1709 % \begin{macro}{\tistyle,\ltstyle,\ofstyle,\altstyle,\regstyle,\embossstyle,\ornamentalstyle,\swashstyle,\shstyle,\qtstyle}
1710 % \changes{2010-07-17}{2015/06/19}{Improve \cs{ofstyle}.}
1711 % These macros again require merging, but not unmerging, names.
1712 % \begin{macrocode}
1713 \DeclareRobustCommand{\tistyle}{%% anniffiniedig titling/display
1714 \not@math@alphabet\tistyle\relax
1715 \exfs@merge@families{d}}
1716 % \end{macrocode}
1717 % Note that this command is for use when the light version is a separate family rather than a weight variant (e.g.\ when you've got light, light bold etc.\ as well as regular weights)
1718 % \begin{macrocode}
1719 \DeclareRobustCommand{\ltstyle}{%% anniffiniedig
1720 \not@math@alphabet\ltstyle\relax
1721 \exfs@merge@families{l}}
1722 % \end{macrocode}
1723 % Let's hope there aren't any fonts with a light family *and* an outline/openface/blank version
1724 % \begin{macrocode}
1725 \DeclareRobustCommand{\ofstyle}{%% anniffiniedig
1726 \not@math@alphabet\ofstyle\relax
1727 \exfs@merge@families{l}}
1728 \DeclareRobustCommand{\altstyle}{%% anniffiniedig alternative style
1729 \not@math@alphabet\altstyle\relax
1730 \exfs@merge@families{a}}
1731 \DeclareRobustCommand{\regstyle}{%% anniffiniedig 'regular' style
1732 \not@math@alphabet\regstyle\relax
1733 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil}}
1734 \DeclareRobustCommand{\embossstyle}{%% anniffiniedig
1735 \not@math@alphabet\embossstyle\relax
1736 \exfs@merge@families{e}}
1737 \DeclareRobustCommand{\ornamentalstyle}{%% anniffiniedig intended primarily for decorative initial fonts etc.
1738 \not@math@alphabet\ornamentalstyle\relax
1739 \exfs@merge@families{p}}
1740 \DeclareRobustCommand{\qtstyle}{%% anniffiniedig quotation style (assumes sans)
1741 \not@math@alphabet\qtstyle\relax
1742 \sffamily
1743 \exfs@merge@families{q}}
1744 \DeclareRobustCommand{\shstyle}{%% anniffiniedig
1745 \not@math@alphabet\shstyle\relax
1746 \exfs@merge@families{h}}
1747 \DeclareRobustCommand{\swashstyle}{%% anniffiniedig an attempt to improve on \swstyle
1748 \not@math@alphabet\swashstyle\relax
1749 \exfs@merge@families{w}}
1750 % \end{macrocode}
1751 % \end{macro}
1752 % \begin{macro}{\tmstyle,\tvstyle}
1753 % \changes{v6140}{2017-03-28}{Modify \cs{tmstyle} and \cs{tvstyle} to unmerge sans and other typewriter before merging appropriate variant.}
1754 % Macros to switch between monowidth and variable typewriter.
1755 % These need to unmerge before merging.
1756 % We need to unmerge sans as well as the other kind of typewriter.
1757 % \begin{macrocode}
1758 \DeclareRobustCommand{\tmstyle}{%% anniffiniedig monowidth typewriter
1759 \not@math@alphabet\tmstyle\relax
1760 \exfs@unmerge@families{s}%
1761 \exfs@unmerge@families{v}%
1762 \exfs@merge@families{t}}
1763 \DeclareRobustCommand{\tvstyle}{%% anniffiniedig variable width typewriter
1764 \not@math@alphabet\tvstyle\relax
1765 \exfs@unmerge@families{s}%
1766 \exfs@unmerge@families{t}%
1767 \exfs@merge@families{v}}
1768 % \end{macrocode}
1769 % \end{macro}
1770 % BEGIN added (cfr) - unmerge families
1771 %
1772 % \begin{macro}{\ifexfs@take,\exfs@unmergefamilies}
1773 % Define the macro needed to do the unmerges.
1774 % \begin{macrocode}
1775 \newif\ifexfs@take
1776 \newcommand*\exfs@unmerge@families[1]{%
1777 \edef\exfs@tempf{#1}%
1778 \edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
1779 \let\exfs@tempq\@empty
1780 \edef\exfs@tempg{}%
1781 \exfs@taketrue
1782 % \end{macrocode}
1783 % Check whether there are variants - if not do nothing
1784 % \begin{macrocode}
1785 \ifx\tempa\@empty
1786 \edef\exfs@tempq{}%
1787 \else
1788 % \end{macrocode}
1789 % o/w go through the variants to find the one to delete
1790 % \begin{macrocode}
1791 \loop
1792 % \end{macrocode}
1793 % Get the next variant
1794 % \begin{macrocode}
1795 \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
1796 % \end{macrocode}
1797 % See if the next variant is the thing we seek and, if so, eliminate it
1798 % \begin{macrocode}
1799 \ifx\exfs@tempf\exfs@tempn
1800 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
1801 \edef\exfs@tempq{\exfs@tempg\tempa}%
1802 \exfs@takefalse
1803 % \end{macrocode}
1804 % o/w save the next variant and move on if any variants remain
1805 % \begin{macrocode}
1806 \else
1807 \edef\exfs@tempg{\exfs@tempg\exfs@tempn}%
1808 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
1809 \ifx\tempa\@empty% if there are no variants left, we're done
1810 \edef\exfs@tempq{\exfs@tempg}%
1811 \exfs@takefalse
1812 \fi
1813 \fi
1814 \ifexfs@take % \fi yn \repeat
1815 \repeat
1816 \fi
1817 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
1818 }
1819 % \end{macrocode}
1820 % \end{macro}
1821 % \begin{macro}{\tstyle,\lstyle}
1822 % These are simple unmerges, with no merging necessary.
1823 % \begin{macrocode}
1824 \DeclareRobustCommand{\tstyle}{%% anniffiniedig tabular figures
1825 \not@math@alphabet\tstyle\relax
1826 \exfs@unmerge@families{2}}
1827 \DeclareRobustCommand{\lstyle}{%% anniffiniedig lining figures (cf. command above)
1828 \not@math@alphabet\lstyle\relax
1829 \exfs@unmerge@families{j}}
1830 % \end{macrocode}
1831 % \end{macro}
1832 % \begin{macro}{\tlstyle,\plstyle,\tostyle}
1833 % Simple combinations for combined figure styles.
1834 %
1835 % Make a combined command for tabular lining
1836 % \begin{macrocode}
1837 \DeclareRobustCommand{\tlstyle}{%% anniffiniedig
1838 \lstyle\tstyle}
1839 % \end{macrocode}
1840 % Proportional lining
1841 % \begin{macrocode}
1842 \DeclareRobustCommand{\plstyle}{%% anniffiniedig
1843 \lstyle\pstyle}
1844 % \end{macrocode}
1845 % Tabular oldstyle {?!}
1846 % \begin{macrocode}
1847 \DeclareRobustCommand{\tostyle}{%% anniffiniedig
1848 \ostyle\tstyle}
1849 % \end{macrocode}
1850 % \end{macro}
1851 % END added
1852 %
1853 % \begin{macro}{\sidefault,\sishape}
1854 % \texttt{si} is italic sc\footnote{%
1855 % That is, italic small-caps \emph{was} \texttt{si}.
1856 % These days, things are more complicated \dots.%
1857 % }.
1858 % We use the original definition for the default and then set up rules for font shape changes which try \texttt{scit} and \texttt{scsl} before falling back to \texttt{si}.
1859 % \begin{macrocode}
1860 \newcommand*{\sidefault}{si}% anniffiniedig
1861 % \end{macrocode}
1862 % Well i brofi \texttt{si} \& yna \texttt{scit} ond wn i ddim sut i wneud hon gyda'r stwff newydd \dots{}.
1863 % I was going to deprecate the \texttt{si} macros, but the truth is they are much nicer than having to combine macros for those cases when you really do want precisely italic small-caps.
1864 % They are also much more robust than somebody trying to force things with \cs{fontshape}\marg{si}\cs{selectfont}, so, on reflection, it seems better to retain the interface, even if the implementation isn't as straightforward as I'd like.
1865 % \begin{macrocode}
1866 \DeclareRobustCommand{\sishape}{%
1867 \exfs@try@shapeshift{si}}
1868 % \end{macrocode}
1869 % \end{macro}
1870 % Kernel virtuals: ulc upper/lower case up upright.
1871 % \lpack{nfssext} virtuals? or \lpack{nfssext-cfr} virtuals? or?
1872 % It would be better to try \texttt{si}, \texttt{scit} and \texttt{scsl}, but that doesn't seem possible
1873 % \begin{macrocode}
1874 \DeclareFontShapeChangeRule {n}{si}{scit}{scsl}% current; request (& trydedd); dewisiad cyntaf; ail ddewisiad
1875 \DeclareFontShapeChangeRule {it}{si}{scit}{scsl}
1876 \DeclareFontShapeChangeRule {sl}{si}{scit}{scsl}
1877 \DeclareFontShapeChangeRule {sc}{si}{scit}{scsl}
1878 % \end{macrocode}
1879 % Current shape is si => font support hasn't been updated
1880 % \begin{macrocode}
1881 \DeclareFontShapeChangeRule {si}{sc} {si} {}
1882 \DeclareFontShapeChangeRule {si}{it} {si} {}
1883 \DeclareFontShapeChangeRule {si}{sl} {scsl} {si}
1884 \DeclareFontShapeChangeRule {si}{scit} {scit} {si}% rhag ofn?!
1885 \DeclareFontShapeChangeRule {si}{ulc} {it} {}
1886 \DeclareFontShapeChangeRule {si}{up}{sc}{}
1887 % \end{macrocode}
1888 %^^A \DeclareFontShapeChangeRule {si}{u} {it} {}
1889 %^^A \DeclareFontShapeChangeRule {si}{su}{sc}{}
1890 % \begin{macrocode}
1891 \ExplSyntaxOn
1892 % \end{macrocode}
1893 % The need for overwriting can be avoided by changing the \file{.fd} files, but \texttt{compat} supports packages I don't know about\footnote{%
1894 % Or haven't published?
1895 % I haven't actually tried it with those.%
1896 % } \dots
1897 % \changes{v1.0}{2024-09-16}{%
1898 % Conditionally override kernel rules affecting switches to upright/small-caps.italic etc.}
1899 % \begin{macrocode}
1900 \bool_if:NT \g__exfs_compat_bool
1901 {
1902 \DeclareFontShapeChangeRule {it}{sc}{si}{scsl}
1903 \DeclareFontShapeChangeRule{sl}{sc}{scsl}{si}
1904 % \end{macrocode}
1905 % Gofyn am italic etc\@. \textbar{} Ask about italic etc\@.
1906 % Sylwadau tebygol yma \dots{} \textbar{} Like comments here \dots{}
1907 % \begin{macrocode}
1908 \DeclareFontShapeChangeRule {sc}{it} {si} {scsl}
1909 \DeclareFontShapeChangeRule {sc}{sl} {scsl} {si}
1910 \DeclareFontShapeChangeRule {scsl}{it} {si} {scsl}
1911 }
1912 \ExplSyntaxOff
1913 % \end{macrocode}
1914 %^^A Ddylai'r rhai hwn ddim yn defnyddio \texttt{scit}/\texttt{scsl} yn lle \textt{si}?
1915 %^^A Pam \texttt{si}??
1916 %^^A \verb|^| Wel, maen nhw'n gwneud felly eisoes??!!
1917 % \changes{v1.0}{2024-09-16}{%
1918 % Unconditionally add a bunch of shape change rules for shapes unsupported by the kernel - I don't *think* these should be problematic: if the current or requested shape is unsupported by the kernel, surely it can't be problematic to support that shape?}
1919 % \begin{macrocode}
1920 \DeclareFontShapeChangeRule {ui}{sc}{scit}{scsl}
1921 \DeclareFontShapeChangeRule {ui}{scsl}{scsl}{scit}
1922 \DeclareFontShapeChangeRule {ui}{it}{it}{ui}
1923 \DeclareFontShapeChangeRule {ui}{ri}{ri}{ui}
1924 \DeclareFontShapeChangeRule {ui}{up}{n}{}
1925 \DeclareFontShapeChangeRule {ui}{ulc}{ui}{}
1926 % \end{macrocode}
1927 %^^A \DeclareFontShapeChangeRule {ui}{u}{n}{}
1928 %^^A \DeclareFontShapeChangeRule {ui}{su}{sc}{}
1929 % \begin{macrocode}
1930 \DeclareFontShapeChangeRule {ri}{sc}{scit}{scsl}
1931 \DeclareFontShapeChangeRule {ri}{scsl}{scsl}{scit}
1932 \DeclareFontShapeChangeRule {ri}{it}{it}{ri}
1933 \DeclareFontShapeChangeRule {ri}{ui}{ui}{ri}
1934 % \end{macrocode}
1935 % Kernel virtuals: \texttt{ulc} upper/lower case up upright
1936 % \begin{macrocode}
1937 \DeclareFontShapeChangeRule {ri}{up}{n}{}
1938 \DeclareFontShapeChangeRule {ri}{ulc}{ri}{}
1939 % \end{macrocode}
1940 % nfssext virtuals? or nfssext-cfr virtuals? or?
1941 %^^A \DeclareFontShapeChangeRule {ri}{u}{n}{}
1942 %^^A \DeclareFontShapeChangeRule {ri}{su}{sc}{}
1943 %^^A \DeclareFontShapeChangeRule {sc}{ri}{scit}{scsl}
1944 %^^A \DeclareFontShapeChangeRule {scsl}{ri}{scsl}{scit}
1945 %^^A \DeclareFontShapeChangeRule {it}{ri}{ri}{it}
1946 %^^A \DeclareFontShapeChangeRule {ui}{ri}{ri}{it}
1947 %^^A \DeclareFontShapeChangeRule {n}{ri}{ri}{it}
1948 %^^A \DeclareFontShapeChangeRule {sl}{ri}{ri}{it}
1949 % \begin{macrocode}
1950 \DeclareFontShapeChangeRule {ol} {sc} {scol} {} % <- seiliedig ar nfssext-cfr-nfss.sty \scshape
1951 \DeclareFontShapeChangeRule {ol} {ulc} {ol} {}
1952 \DeclareFontShapeChangeRule {ol} {up} {ol} {}
1953 % \end{macrocode}
1954 %^^A \DeclareFontShapeChangeRule {ol} {u} {ol} {}
1955 %^^A \DeclareFontShapeChangeRule {ol} {su} {scol} {}
1956 % \begin{macrocode}
1957 \DeclareFontShapeChangeRule {scol} {sc} {scol} {}
1958 \DeclareFontShapeChangeRule {scol} {ulc} {ol} {}
1959 \DeclareFontShapeChangeRule {scol} {up} {scol} {}
1960 % \end{macrocode}
1961 % \iffalse
1962 %^^A \DeclareFontShapeChangeRule {scol} {u} {scol} {}
1963 %^^A \DeclareFontShapeChangeRule {scol} {su} {scol} {}
1964 %^^A \DeclareFontShapeChangeRule {sc} {sc} {sc} {} % <- ??
1965 % \fi
1966 % \begin{macrocode}
1967 \DeclareFontShapeChangeRule {u}{sc}{su}{} % <- seiliedig ar nfssext-cfr-nfss.sty \scshape
1968 \DeclareFontShapeChangeRule {su}{ulc}{u}{}
1969 \DeclareFontShapeChangeRule {sc}{u}{su}{}
1970 \DeclareFontShapeChangeRule {su}{u}{su}{}
1971 \DeclareFontShapeChangeRule {su}{sc}{su}{}
1972 % \end{macrocode}
1973 %^^A \DeclareFontShapeChangeRule {u} {ulc} {u} {} % <- ??
1974 %^^A \DeclareFontShapeChangeRule {u} {up} {u} {} % <- ??
1975 %^^A \DeclareFontShapeChangeRule {su} {sc} {su} {} % <- ??
1976 %^^A \DeclareFontShapeChangeRule {su} {ulc} {u} {} % <- ??
1977 %^^A \DeclareFontShapeChangeRule {su} {up} {u} {} % <- ??
1978 % BEGIN added (cfr)
1979 %
1980 % cfr: is this how outline shapes should be handled?
1981 % \begin{macro}{\oldefault,\olshape,\scoldefault,\scolshape}
1982 % Outline
1983 % \begin{macrocode}
1984 \newcommand*{\oldefault}{ol}% anniffiniedig
1985 \DeclareRobustCommand{\olshape}{%% anniffiniedig
1986 \exfs@try@shapeshift{ol}}
1987 \newcommand*{\scoldefault}{scol}% anniffiniedig
1988 \DeclareRobustCommand{\scolshape}{%% anniffiniedig
1989 \exfs@try@shapeshift{scol}}
1990 % \end{macrocode}
1991 % \end{macro}
1992 % \begin{macro}{\udefault,\ushape,\scudefault,\scushape}
1993 % Underlined??
1994 %^^A\DeclareRobustCommand{\olshape}{%
1995 %^^A \not@math@alphabet\olshape\relax
1996 %^^A \exfs@merge@shape{\oldefault}{\scdefault}{\scoldefault}}
1997 % Fudge <- ??
1998 % \begin{macrocode}
1999 \newcommand*{\udefault}{u}% anniffiniedig
2000 \DeclareRobustCommand{\ushape}{%% anniffiniedig
2001 \exfs@try@shapeshift{u}}
2002 \newcommand*{\scudefault}{su}% anniffiniedig
2003 \DeclareRobustCommand{\scushape}{%% anniffiniedig
2004 \exfs@try@shapeshift{scu}}
2005 % \end{macrocode}
2006 % \end{macro}
2007 % \begin{macro}{\uidefault,\uishape,\ridefault,\rishape}
2008 % Upright and reverse italic
2009 % \begin{macrocode}
2010 \newcommand*{\uidefault}{ui}% anniffiniedig
2011 \DeclareRobustCommand{\uishape}{% anniffiniedig
2012 \exfs@try@shapeshift{ui}}
2013 % \end{macrocode}
2014 % Can i do this for reverse italic?
2015 % \begin{macrocode}
2016 \newcommand*{\ridefault}{ri}% anniffiniedig
2017 \DeclareRobustCommand{\rishape}{% anniffiniedig
2018 \exfs@try@shapeshift{ri}}
2019 % \end{macrocode}
2020 % \end{macro}
2021 % END added
2022 %^^A \newcommand*{\exfs@merge@shape}[3]{%
2023 %^^A \edef\exfs@tempa{#1}%
2024 %^^A \edef\exfs@tempb{#2}%
2025 %^^A \ifx\f@shape\exfs@tempb
2026 %^^A \expandafter\ifx\csname\f@encoding/\f@family/\f@series/#3\endcsname\relax
2027 %^^A \else
2028 %^^A \edef\exfs@tempa{#3}%
2029 %^^A \fi
2030 %^^A \fi
2031 %^^A \fontshape{\exfs@tempa}\selectfont}
2032 % BEGIN added (cfr) - merge width changes into series
2033 %^^A \newcommand*{\exfs@font@width}{% ??
2034 %^^A \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
2035 %^^A \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
2036 %^^A \ifx\exfs@temppart\@empty
2037 %^^A \def\exfs@width{}
2038 %^^A \else
2039 %^^A \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
2040 %^^A \ifx\exfs@temps{b}
2041 %^^A \edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
2042 %^^A \else
2043 %^^A \ifx\exfs@temps{l}
2044 %^^A \edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
2045 %^^A \else
2046 %^^A \edef\exfs@width{\exfs@temppart}%
2047 %^^A \fi
2048 %^^A \fi
2049 %^^A \fi
2050 %^^A \exfs@width
2051 %^^A }
2052 %
2053 % \begin{macro}{\exfs@merge@width}
2054 % Previously dependent on incorrect series names.
2055 % \changes{v1.0}{2024-09-16}{Do not depend on incorrect series names, which are no longer supported.}
2056 % \begin{macrocode}
2057 \newcommand*{\exfs@merge@width}[1]{%
2058 % \end{macrocode}
2059 %^^A \edef\exfs@temph{#1}%
2060 %^^A \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
2061 %^^A \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
2062 %^^A \def\tempb{b}%
2063 %^^A \def\templ{l}%
2064 % cfr-added
2065 %
2066 % Dibynnodd y côd gwreiddiol ar *mc* etc. \& r'odd hynny'n anghywir
2067 %
2068 % Instead of merging or unmerging cyclically, which means keeping track of everything, we split the current series (which requires some juggling, but hopefully less) and use the results.
2069 % \begin{macrocode}
2070 \exfs@series@splitter{\f@series}%
2071 \edef\exfs@temph{#1}%
2072 \if\exfs@temph m\ifx\exfs@weight\@empty\else\let\exfs@temph\@empty\fi\fi
2073 \if\exfs@weight m\ifx\exfs@temph\@empty\else\let\exfs@weight\@empty\fi\fi
2074 \edef\exfs@series{\exfs@weight\exfs@temph}%
2075 % \end{macrocode}
2076 % end cfr-added
2077 %^^A \ifx\exfs@tempf\tempm\edef\exfs@tempf{}\fi %
2078 %^^A \ifx\exfs@temppart\@empty
2079 %^^A \def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
2080 %^^A \else
2081 %^^A \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
2082 %^^A \ifx\exfs@temps\tempb
2083 %^^A \def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
2084 %^^A \else
2085 %^^A \ifx\exfs@temps\templ
2086 %^^A \def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
2087 %^^A \else
2088 %^^A \def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
2089 %^^A \fi
2090 %^^A \fi
2091 %^^A \fi
2092 %^^A \edef\tempy{\exfs@series}\show\tempy
2093 % \begin{macrocode}
2094 \exfs@info{Trying \exfs@series}%
2095 \exfs@try@series{\exfs@series}}
2096 % \end{macrocode}
2097 % \end{macro}
2098 %^^A \fontseries\exfs@series\selectfont}
2099 %^^A \newcommand*{\exfs@unmerge@width}{%
2100 %^^A \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
2101 %^^A \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
2102 %^^A \def\tempb{b}%
2103 %^^A \def\templ{l}%
2104 %^^A \def\tempe{}%
2105 %^^A \ifx\exfs@temppart\@empty
2106 %^^A \def\exfs@series{\expandafter\exfs@tempf}%
2107 %^^A \else
2108 %^^A \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
2109 %^^A \ifx\exfs@temps\tempb
2110 %^^A \def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
2111 %^^A \else
2112 %^^A \ifx\exfs@temps\templ
2113 %^^A \def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
2114 %^^A \else
2115 %^^A \def\exfs@series{\expandafter\exfs@tempf}%
2116 %^^A \fi
2117 %^^A \fi
2118 %^^A \fi
2119 %^^A \ifx\tempe\exfs@series\def\exfs@series{m}\fi % angen efaillai?
2120 %^^A \exfs@try@series{\exfs@series}}
2121 % \begin{macro}{\regwidth}
2122 % ‘Regular’ width requires conditionally adding ‘m’.
2123 % \begin{macrocode}
2124 \DeclareRobustCommand{\regwidth}{%% anniffiniedig
2125 \not@math@alphabet\regwidth\relax
2126 % \end{macrocode}
2127 % cfr altered
2128 % \begin{macrocode}
2129 \exfs@merge@width{m}}
2130 % \end{macrocode}
2131 %^^A \exfs@unmerge@width}
2132 % \end{macro}
2133 % \begin{macro}{\nwdefault,\nwwidth,\cddefault,\cdwidth,\ecdefault,\ecwidth,\ucdefault,\ucwidth}
2134 % Condensed widths.
2135 % \begin{macrocode}
2136 \newcommand*{\nwdefault}{c}% anniffiniedig
2137 \DeclareRobustCommand{\nwwidth}{%% anniffiniedig ond rheolau
2138 \not@math@alphabet\nwwidth\relax
2139 \exfs@merge@width{\nwdefault}}% neu \exfs@try@series ?
2140 \newcommand*{\cddefault}{c}% anniffiniedig
2141 \DeclareRobustCommand{\cdwidth}{% anniffiniedig ond rheolau
2142 \not@math@alphabet\cdwidth\relax
2143 \exfs@merge@width{\cddefault}}% neu \exfs@try@series ?
2144 \newcommand*{\ecdefault}{ec}% anniffiniedig
2145 \DeclareRobustCommand{\ecwidth}{%% anniffiniedig ond rheolau
2146 \not@math@alphabet\ecwidth\relax
2147 \exfs@merge@width{\ecdefault}}% neu \exfs@try@series ?
2148 \newcommand*{\ucdefault}{uc}% anniffiniedig
2149 \DeclareRobustCommand{\ucwidth}{%% anniffiniedig
2150 \not@math@alphabet\ucwidth\relax
2151 \exfs@merge@width{\ucdefault}}
2152 % \end{macrocode}
2153 % \end{macro}
2154 % \begin{macro}{\etdefault,\etwidth,\epdefault,\epwidth,\exdefault,\exwidth,\uxdefault,\uxwidth}
2155 % Extended/expanded widths.
2156 % \begin{macrocode}
2157 \newcommand*{\etdefault}{x}% anniffiniedig
2158 \DeclareRobustCommand{\etwidth}{%% anniffiniedig
2159 \not@math@alphabet\etwidth\relax
2160 \exfs@merge@width{\etdefault}}% neu \exfs@try@series ?
2161 \newcommand*{\epdefault}{x}% anniffiniedig
2162 \DeclareRobustCommand{\epwidth}{%% anniffiniedig ond rheolau
2163 \not@math@alphabet\epwidth\relax
2164 \exfs@merge@width{\epdefault}}% neu \exfs@try@series ?
2165 \newcommand*{\exdefault}{ex}% anniffiniedig
2166 \DeclareRobustCommand{\exwidth}{%% anniffiniedig
2167 \not@math@alphabet\exwidth\relax
2168 \exfs@merge@width{\exdefault}}
2169 \newcommand*{\uxdefault}{ux}% anniffiniedig
2170 \DeclareRobustCommand{\uxwidth}{%% anniffiniedig
2171 \not@math@alphabet\uxwidth\relax
2172 \exfs@merge@width{\uxdefault}}
2173 % \end{macrocode}
2174 % \end{macro}
2175 % \begin{macro}{\mdwdefault,\mdwidth}
2176 % Medium.
2177 % \begin{macrocode}
2178 \newcommand*\mdwdefault{m}
2179 \DeclareRobustCommand{\mdwidth}{%% anniffiniedig
2180 \not@math@alphabet\mdwidth\relax
2181 \exfs@merge@width{\mdwdefault}}
2182 % \end{macrocode}
2183 % \end{macro}
2184 % Posibl ond bydda i'n colli achosion yn siwr.
2185 % \textbar{} Possible but I'd lose cases for sure.
2186 % Hefyd hoffwn i ddim dyfalu pa rheolau y bydden nhw eu dewis.
2187 % \textbar{} Also I wouldn't like to guess which rules they'll choose.
2188 %^^A \DeclareFontSeriesChangeRule {bc}{ux}{bux}{bc}
2189 %^^A \DeclareFontSeriesChangeRule {bx}{ux}{bux}{bx}
2190 %^^A \DeclareFontSeriesChangeRule {b}{ux} {bux} {b}
2191 %^^A \DeclareFontSeriesChangeRule {c}{ux}{ux}{m}
2192 %^^A \DeclareFontSeriesChangeRule {ebc}{ux}{ebux}{}
2193 %^^A \DeclareFontSeriesChangeRule {ec}{ux}{ux}{m}
2194 %^^A \DeclareFontSeriesChangeRule {sc}{ux}{ux}{m}
2195 %^^A \DeclareFontSeriesChangeRule {ebx}{ux}{ebux}{ebx}
2196 %^^A \DeclareFontSeriesChangeRule {eb}{ux}{ebux}{}
2197 %^^A \DeclareFontSeriesChangeRule {elc}{ux}{elux}{}
2198 %^^A \DeclareFontSeriesChangeRule {elx}{ux}{elux}{elx}
2199 %^^A \DeclareFontSeriesChangeRule {el}{ux}{elux}{}
2200 %^^A \DeclareFontSeriesChangeRule {lc}{ux}{lux}{}
2201 %^^A \DeclareFontSeriesChangeRule {lx}{ux}{lux}{lx}
2202 %^^A \DeclareFontSeriesChangeRule {l}{ux} {lux} {l}
2203 %^^A \DeclareFontSeriesChangeRule {m}{ux} {ux} {m}
2204 %^^A \DeclareFontSeriesChangeRule {sbc}{ux}{sbux}{}
2205 %^^A \DeclareFontSeriesChangeRule {sbx}{ux}{sbux}{sbx}
2206 %^^A \DeclareFontSeriesChangeRule {sb}{ux} {sbux} {}
2207 %^^A \DeclareFontSeriesChangeRule {slc}{ux}{slux}{}
2208 %^^A \DeclareFontSeriesChangeRule {sl}{ux}{slux}{}
2209 %^^A \DeclareFontSeriesChangeRule {ubc}{ux}{ubux}{}
2210 %^^A \DeclareFontSeriesChangeRule {ubx}{ux}{ubux}{ubx}
2211 %^^A \DeclareFontSeriesChangeRule {ub}{ux}{ubux}{}
2212 %^^A \DeclareFontSeriesChangeRule {ulc}{ux}{ulux}{}
2213 %^^A \DeclareFontSeriesChangeRule {ulx}{ux}{ulux}{ulx}
2214 %^^A \DeclareFontSeriesChangeRule {ul}{x}{ulx}{}
2215 %^^A \DeclareFontSeriesChangeRule {x}{ul}{ulx}{}
2216 %^^A \DeclareFontSeriesChangeRule {ux}{m?}{ux}{}
2217 %^^A \DeclareFontSeriesChangeRule {ux}{?m}{m}{}
2218 %
2219 % BEGIN added (cfr) merge weight changes into series
2220 %
2221 % \begin{macro}{\exfs@merge@weight}
2222 % The pay off for setting up series splitting is that we can reuse the method here and, as in the case of width, the definition is greatly simplified\footnote{%
2223 % At least if you don't look at the splitter code.}.
2224 % \begin{macrocode}
2225 \newcommand*{\exfs@merge@weight}[1]{%
2226 \exfs@series@splitter{\f@series}%
2227 % \end{macrocode}
2228 % Save current series so we can test for change
2229 % \begin{macrocode}
2230 \let\exfs@tempg\f@series
2231 \def\exfs@temph{#1}%
2232 \if\exfs@temph m\relax
2233 \ifx\exfs@width\@empty\relax
2234 \else
2235 \let\exfs@temph\@empty
2236 \fi
2237 \fi
2238 \edef\exfs@series{\exfs@temph\exfs@width}%
2239 \ifx\exfs@temph\exfs@series
2240 \exfs@info{Trying \exfs@series}%
2241 \exfs@try@series{\exfs@series}%
2242 \else
2243 \exfs@info{Trying \exfs@series, favouring \exfs@weight}%
2244 \exfs@try@series[\exfs@weight]{\exfs@series}% assume user wants to change weight even if this changes back to the default width
2245 \fi}
2246 % \end{macrocode}
2247 % \end{macro}
2248 %^^A Meddwl bod y côd hwn yn dibynnu ar y problem 'm' eto
2249 %^^A Ond alla i ddim jest ychwanegu un
2250 %^^A \edef\exfs@tempg{#1}%
2251 %^^A \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
2252 %^^A \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
2253 %^^A \def\templ{l}%
2254 %^^A \def\tempb{b}%
2255 %^^A Case when there's no second part, so the single character must be the weight and should be replaced
2256 %^^A \ifx\exfs@temppart\@empty
2257 %^^A \def\exfs@series{\expandafter\exfs@tempg}%
2258 %^^A %:case when there's a second part
2259 %^^A \else
2260 %^^A %:get first character of second part
2261 %^^A \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
2262 %^^A \edef\exfs@tempw{\expandafter\exfs@part\exfs@temps\@nil }%
2263 %^^A %:is the first character b? if so, it is part of the weight and should be replaced
2264 %^^A \ifx\exfs@temps\tempb
2265 %^^A \def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
2266 %^^A \else
2267 %^^A %:is the first character l? if so, it is part of the weight and should be replaced
2268 %^^A \ifx\exfs@temps\templ
2269 %^^A \def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
2270 %^^A \else
2271 %^^A %:o/w the first character is part of the width and should be retained
2272 %^^A \def\exfs@series{\expandafter\exfs@tempg\exfs@temppart}%
2273 %^^A \fi
2274 %^^A \fi
2275 %^^A \fi
2276 %^^A %\fontseries\exfs@series\selectfont}
2277 %^^A \ifx\exfs@tempg\exfs@series
2278 %^^A \exfs@try@series{\exfs@series}%
2279 %^^A \else
2280 %^^A \exfs@try@series[\exfs@tempg]{\exfs@series}% assume user wants to change weight even if this changes back to the default width
2281 %^^A \fi}
2282 % \begin{macro}{\mbdefault,\mbweight,\bddefault,\bfweight,\bdweight}
2283 % Ref.: \file{sources2e.pdf} and/or stripped code in \path{base}.
2284 %
2285 % The annotation ‘anniffiniedig’ indicates the macro is \emph{not} defined by the kernel as of 2024.
2286 % The addition ‘ond rheolau’ means there are nonetheless relevant rules.
2287 % The comment ‘dim byd i'w gael eu wneud yma’ indicates that defining the default is now sufficient and no additional font switch or text command is required.
2288 % \begin{macrocode}
2289 \newcommand*{\mbdefault}{sb}% dim byd i'w gael ei wneud yma
2290 \DeclareRobustCommand{\mbweight}{%% anniffiniedig
2291 \not@math@alphabet\mbweight\relax
2292 \exfs@merge@weight{\mbdefault}}
2293 \newcommand*{\bddefault}{b}% dim byd i'w gael ei wneud yma
2294 \DeclareRobustCommand{\bfweight}{%% anniffiniedig
2295 \not@math@alphabet\bfweight\relax
2296 \exfs@merge@weight{\bddefault}}
2297 \DeclareRobustCommand{\bdweight}{%% anniffiniedig
2298 \not@math@alphabet\bdweight\relax
2299 \exfs@merge@weight{\bddefault}}
2300 % \end{macrocode}
2301 % \end{macro}
2302 % \begin{macro}{\mwdefault,\mdweight}
2303 % Regular, medium, default are all irregular, exceptional, fraught.
2304 % \begin{macrocode}
2305 \newcommand*\mwdefault{m}
2306 \DeclareRobustCommand{\mdweight}{%% anniffiniedig
2307 \not@math@alphabet\mdweight\relax
2308 \exfs@merge@weight{\mwdefault}}
2309 % \end{macrocode}
2310 % \end{macro}
2311 % \begin{macro}{\dbdefault,\dbweight,\sbdefault,\sbweight,\ebdefault,\ebweight,\ubdefault,\ubweight}
2312 % \changes{v1.0}{2024-09-16}{%
2313 % Make \cs{mbdefault} sb (duplicating \cs{sbdefault}) as I can't come up with anything better.}
2314 % Heavy weights.
2315 % \begin{macrocode}
2316 \newcommand*{\dbdefault}{db}% anniffiniedig
2317 \DeclareRobustCommand{\dbweight}{%% anniffiniedig
2318 \not@math@alphabet\dbweight\relax
2319 \exfs@merge@weight{\dbdefault}}
2320 \newcommand*{\sbdefault}{sb}% anniffiniedig
2321 \DeclareRobustCommand{\sbweight}{%% anniffiniedig ond rheolau
2322 \not@math@alphabet\sbweight\relax
2323 \exfs@merge@weight{\sbdefault}}% neu \exfs@try@series ?
2324 \newcommand*{\ebdefault}{eb}% anniffiniedig
2325 \DeclareRobustCommand{\ebweight}{%% anniffiniedig ond rheolau
2326 \not@math@alphabet\ebweight\relax
2327 \exfs@merge@weight{\ebdefault}}% neu \exfs@try@series ?
2328 \newcommand*{\ubdefault}{ub}% anniffiniedig
2329 \DeclareRobustCommand{\ubweight}{%% anniffiniedig ond rheolau
2330 \not@math@alphabet\ubweight\relax
2331 \exfs@merge@weight{\ubdefault}}% neu \exfs@try@series ?
2332 % \end{macrocode}
2333 % \end{macro}
2334 % \begin{macro}{\lgdefault,\lgweight,\eldefault,\elweight,\uldefault,\ulweight}
2335 % Light weights.
2336 % \begin{macrocode}
2337 \newcommand*{\lgdefault}{l}% anniffiniedig
2338 % \end{macrocode}
2339 % Note - use this if light is a variant weight, rather than a separate family
2340 % \begin{macrocode}
2341 \DeclareRobustCommand{\lgweight}{%% anniffiniedig ond rheolau
2342 \not@math@alphabet\lgweight\relax
2343 \exfs@merge@weight{\lgdefault}}% neu \exfs@try@series ?
2344 \newcommand*{\eldefault}{el}% anniffiniedig
2345 \DeclareRobustCommand{\elweight}{%% anniffiniedig ond rheolau
2346 \not@math@alphabet\elweight\relax
2347 \exfs@merge@weight{\eldefault}}% neu \exfs@try@series ?
2348 \newcommand*{\uldefault}{ul}% anniffiniedig
2349 \DeclareRobustCommand{\ulweight}{%% anniffiniedig ond rheolau
2350 \not@math@alphabet\ulweight\relax
2351 \exfs@merge@weight{\uldefault}}% neu \exfs@try@series ?
2352 % \end{macrocode}
2353 % \end{macro}
2354 % END added
2355 %^^A \DeclareRobustCommand{\itshape}{%
2356 %^^A \not@math@alphabet\itshape\mathit
2357 %^^A \exfs@merge@shape{\itdefault}{\scdefault}{\sidefault}}
2358 % Original
2359 %^^A\DeclareRobustCommand{\scshape}{%
2360 %^^A \not@math@alphabet\scshape\relax
2361 %^^A \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}}
2362 %^^A BEGIN cfr-altered: \scshape
2363 %^^A \DeclareRobustCommand{\scshape}{%
2364 %^^A \not@math@alphabet\scshape\relax
2365 %^^A \def\tempu{u}%
2366 %^^A \def\tempo{ol}%
2367 %^^A \ifx\f@shape\tempu
2368 %^^A \exfs@merge@shape{\scdefault}{\udefault}{\scudefault}%
2369 %^^A \else
2370 %^^A \ifx\f@shape\tempo
2371 %^^A \exfs@merge@shape{\scdefault}{\oldefault}{\scoldefault}%
2372 %^^A \else
2373 %^^A \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}%
2374 %^^A \fi
2375 %^^A \fi}
2376 %^^A END end-altered
2377 %^^A \DeclareRobustCommand{\upshape}{%
2378 %^^A \not@math@alphabet\upshape\relax
2379 %^^A \exfs@merge@shape{\updefault}{\sidefault}{\scdefault}}
2380 % \begin{macro}{\dfshape}
2381 % Something simpler.
2382 % \begin{macrocode}
2383 \let\dfshape\normalshape
2384 % \end{macrocode}
2385 % \end{macro}
2386 %^^A \DeclareRobustCommand{\dfshape}{%
2387 %^^A \not@math@alphabet\dfshape\relax
2388 %^^A \fontshape\shapedefault\selectfont}
2389 % \begin{macro}{\swashapedefault}
2390 % cfr: be' i wneud am hwn?
2391 % \begin{macrocode}
2392 \newcommand*{\swshapedefault}{\itdefault}
2393 % \end{macrocode}
2394 % \end{macro}
2395 % \LaTeX{} ddim yn cynnwys \cs{swstyle} felly \dots?
2396 % \textbar{} \LaTeX{} doesn't include \cs{swstyle} so \dots?
2397 % \begin{macrocode}
2398 \ExplSyntaxOn
2399 \hook_gput_code:nnn {begindocument}{.}
2400 {% compatibility with original nfss \swshape
2401 % \end{macrocode}
2402 % Note this doesn't affect \cs{swashstyle} or \cs{textswash}
2403 % \begin{macro}{\swshape}
2404 % \changes{v1.0}{2024-09-16}{%
2405 % Conditionally overwrite \cs{swshape} to take account of default setting.
2406 % This is not for any package I know of on \ctan, but the original code used \cs{textsw}.%
2407 % }%
2408 % Conditional definition.
2409 % We overwrite the kernel's definition either way.
2410 % The \texttt{compat} option determines only with what we overwrite it.
2411 % \begin{macrocode}
2412 \bool_if:NTF \g__exfs_compat_bool
2413 {
2414 \DeclareRobustCommand{\swshape}
2415 {
2416 \not@math@alphabet\swshape\relax
2417 \swstyle\fontshape\swshapedefault\selectfont
2418 }
2419 \PackageWarning{nfssext-cfr}{
2420 Overwriting ~ kernel ~ definition ~ of ~ \swshape \space (compat)
2421 }
2422 }{
2423 \DeclareRobustCommand \swshape
2424 {
2425 \not@math@alphabet\swshape\relax
2426 \exfs@swshape
2427 }
2428 \PackageWarning{nfssext-cfr}{
2429 Overwriting ~ kernel ~ definition ~ of ~ \swshape \space (new)
2430 }
2431 }
2432 % \end{macrocode}
2433 % \end{macro}
2434 % \begin{macro}{\textin}
2435 % Conditional definition.
2436 % \changes{v1.3}{2025-06-22}{All \cs{textin} if \lpack{hyperref} is new enough to avoid conflict.}
2437 % \begin{macrocode}
2438 \@ifpackageloaded{hyperref}{
2439 \expandafter\@ifl@t@r \csname [email protected]\endcsname {2025/05/20}{
2440 \DeclareTextFontCommand{\textin}{\instyle}
2441 }{
2442 \hook_gput_code:nnn { cmd/textin/before } { . }
2443 {
2444 \exfs@info{
2445 Note ~ that ~ '\protect\textin' ~ is ~ defined ~ by ~ hyperref.\MessageBreak
2446 Use ~ for ~ inferior ~ digits ~ will ~ yield ~ an\MessageBreak
2447 undefined ~ command ~ error ~ in ~ document ~ font ~ encodings.\MessageBreak
2448 Use ~ '\protect\textinf' ~ to ~ access ~ inferior ~ digits.\MessageBreak
2449 Alternatively, ~ update ~ hyperref ~ to ~ 2025-05-20 ~ or ~ later
2450 }
2451 }
2452 }
2453 }{
2454 \DeclareTextFontCommand{\textin}{\instyle}
2455 }
2456 % \end{macrocode}
2457 % \end{macro}
2458 % \begin{macrocode}
2459 }
2460 \ExplSyntaxOff
2461 % \end{macrocode}
2462 % \begin{macro}{\textln,\textos,\textinf,\textsu,\textsi,\textdf}
2463 % The annotation ‘anniffiniedig’ indicates the macro is \emph{not} defined by the kernel as of 2024.
2464 % \begin{macrocode}
2465 \DeclareTextFontCommand{\textln}{\lnstyle}% anniffiniedig
2466 \DeclareTextFontCommand{\textos}{\osstyle}% anniffiniedig
2467 \DeclareTextFontCommand{\textinf}{\instyle}% anniffiniedig
2468 \DeclareTextFontCommand{\textsu}{\sustyle}% anniffiniedig
2469 \DeclareTextFontCommand{\textsi}{\sishape}% anniffiniedig
2470 \DeclareTextFontCommand{\textdf}{\dfshape}% anniffiniedig
2471 % \end{macrocode}
2472 % \end{macro}
2473 % \cs{textsw} is already defined on newer kernels with essentially the same meaning as \lpack{nfssext} originally gave it, so we remove the definition here.
2474 % However, the redefinition of \cs{swshape} means \cs{textsw} is effectively redefined, so the kernel definition is only technically retained.
2475 %
2476 % BEGIN added (cfr)
2477 %
2478 % \begin{macro}{\textti,\textlt,\textof,\textalt,\textreg,\emboss,\textorn,\textqt,\textsh,\texttm,\texttv}
2479 % Families
2480 % \begin{macrocode}
2481 \DeclareTextFontCommand{\textti}{\tistyle}% anniffiniedig
2482 \DeclareTextFontCommand{\textlt}{\ltstyle}% anniffiniedig
2483 \DeclareTextFontCommand{\textof}{\ofstyle}% anniffiniedig % open-face (or outline or blank) style
2484 \DeclareTextFontCommand{\textalt}{\altstyle}% anniffiniedig % alternative style
2485 \DeclareTextFontCommand{\textreg}{\regstyle}% anniffiniedig % `regular' style
2486 \DeclareTextFontCommand{\emboss}{\embossstyle}% anniffiniedig
2487 \DeclareTextFontCommand{\textorn}{\ornamentalstyle}% anniffiniedig % intended primarily for decorative initials etc.
2488 \DeclareTextFontCommand{\textqt}{\qtstyle}% anniffiniedig
2489 \DeclareTextFontCommand{\textsh}{\shstyle}% anniffiniedig % shadowed style
2490 \DeclareTextFontCommand{\texttm}{\tmstyle}% anniffiniedig
2491 \DeclareTextFontCommand{\texttv}{\tvstyle}% anniffiniedig
2492 % \end{macrocode}
2493 % \end{macro}
2494 % \begin{macro}{\textl,\texto,\textp,\textt,\textpl,\textpo,\texttl,\textto}
2495 % Families - figures
2496 % \begin{macrocode}
2497 \DeclareTextFontCommand{\textl}{\lstyle}% anniffiniedig
2498 \DeclareTextFontCommand{\texto}{\ostyle}% anniffiniedig
2499 \DeclareTextFontCommand{\textp}{\pstyle}% anniffiniedig
2500 \DeclareTextFontCommand{\textt}{\tstyle}% anniffiniedig
2501 \DeclareTextFontCommand{\textpl}{\plstyle}% anniffiniedig
2502 \DeclareTextFontCommand{\textpo}{\postyle}% anniffiniedig
2503 \DeclareTextFontCommand{\texttl}{\tlstyle}% anniffiniedig
2504 \DeclareTextFontCommand{\textto}{\tostyle}% anniffiniedig
2505 % \end{macrocode}
2506 % \end{macro}
2507 % \begin{macro}{\textol,\textswash,\textu,\textscu,\textui,\textri}
2508 % Shapes
2509 % \begin{macrocode}
2510 \DeclareTextFontCommand{\textol}{\olshape}% anniffiniedig % outline
2511 \DeclareTextFontCommand{\textswash}{\swashstyle}% anniffiniedig % an attempt to improve on \textsw
2512 \DeclareTextFontCommand{\textu}{\ushape}% anniffiniedig % be' yw hwn?! <_ underlined?
2513 \DeclareTextFontCommand{\textscu}{\scushape}% anniffiniedig
2514 \DeclareTextFontCommand{\textui}{\uishape}% anniffiniedig % upright italic
2515 \DeclareTextFontCommand{\textri}{\rishape}% anniffiniedig % reverse italic
2516 % \end{macrocode}
2517 % \end{macro}
2518 % \begin{macro}{\textnw,\textcd,\textec,\textuc,\textet,\textep,\textex,\textux,\textrw}
2519 % Widths
2520 % \begin{macrocode}
2521 \DeclareTextFontCommand{\textnw}{\nwwidth}% anniffiniedig
2522 \DeclareTextFontCommand{\textcd}{\cdwidth}% anniffiniedig
2523 \DeclareTextFontCommand{\textec}{\ecwidth}% anniffiniedig
2524 \DeclareTextFontCommand{\textuc}{\ucwidth}% anniffiniedig
2525 \DeclareTextFontCommand{\textet}{\etwidth}% anniffiniedig
2526 \DeclareTextFontCommand{\textep}{\epwidth}% anniffiniedig
2527 \DeclareTextFontCommand{\textex}{\exwidth}% anniffiniedig
2528 \DeclareTextFontCommand{\textux}{\uxwidth}% anniffiniedig
2529 \DeclareTextFontCommand{\textrw}{\regwidth}% anniffiniedig
2530 % \end{macrocode}
2531 % \end{macro}
2532 % \begin{macro}{\textmb,\textdb,\textbd,\textsb,\texteb,\textub,\textlg,\textel,\textul}
2533 % Weights
2534 % \begin{macrocode}
2535 \DeclareTextFontCommand{\textmb}{\mbweight}% anniffiniedig
2536 \DeclareTextFontCommand{\textdb}{\dbweight}% anniffiniedig
2537 \DeclareTextFontCommand{\textbd}{\bdweight}% new?
2538 \DeclareTextFontCommand{\textsb}{\sbweight}% anniffiniedig
2539 \DeclareTextFontCommand{\texteb}{\ebweight}% anniffiniedig
2540 \DeclareTextFontCommand{\textub}{\ubweight}% anniffiniedig
2541 \DeclareTextFontCommand{\textlg}{\lgweight}% anniffiniedig
2542 \DeclareTextFontCommand{\textel}{\elweight}% anniffiniedig
2543 \DeclareTextFontCommand{\textul}{\ulweight}% anniffiniedig
2544 % \end{macrocode}
2545 % \end{macro}
2546 % END added
2547 %
2548 % BEGIN patch font initialisation for Latin Modern
2549 %
2550 % Stop redefinition of bold if using Latin Modern as \texttt{clm}.
2551 % Kernel default only blocks redefinition for \texttt{lm}.
2552 % Don't rely on \lpack{cfr-lm} internal macros as they may change without notice \dots{}.
2553 % We don't need Dunhill, though, because it doesn't have bold of any kind.
2554 % \lpack{cfr-lm} doesn't support using Quotation Sans as default or using e.g.~serif as default sans, but there's nothing to stop somebody doing that so follow the kernel here even though it makes for a massive list\footnote{%
2555 % I know this will go off the page when typeset, but I have no idea whether I can safely insert line breaks into the patch and I shall scream if I break this again. (Pun fully intended.)%
2556 % }.
2557 % \begin{macrocode}
2558 \patchcmd{\init@series@setup}{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt}{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt,clm,clm2,clm2j,clmj,clm2js,clm2s,clmjs,clms,clm2jt,clm2t,clmjt,clmt,clm2jv,clm2v,clmjv,clmv,clm2jqs,clm2qs,clmjqs,clmqs}{%
2559 \PackageWarning{nfssext-cfr}{%
2560 Patching font initialisation macro for serif.%
2561 }%
2562 }{%
2563 \PackageWarning{nfssext-cfr}{%
2564 Failed to patch font initialisation macro for serif.%
2565 }%
2566 }
2567 \patchcmd{\init@series@setup}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt}}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt,clm,clm2,clm2j,clmj,clm2js,clm2s,clmjs,clms,clm2jt,clm2t,clmjt,clmt,clm2jv,clm2v,clmjv,clmv,clm2jqs,clm2qs,clmjqs,clmqs}}{%
2568 \PackageWarning{nfssext-cfr}{%
2569 Patching font initialisation macro for sans.%
2570 }%
2571 }{%
2572 \PackageWarning{nfssext-cfr}{%
2573 Failed to patch font initialisation macro for sans.%
2574 }%
2575 }
2576 \patchcmd{\init@series@setup}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt}}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt,clm,clm2,clm2j,clmj,clm2js,clm2s,clmjs,clms,clm2jt,clm2t,clmjt,clmt,clm2jv,clm2v,clmjv,clmv,clm2jqs,clm2qs,clmjqs,clmqs}}{%
2577 \PackageWarning{nfssext-cfr}{%
2578 Patching font initialisation macro for typewriter.%
2579 }%
2580 }{%
2581 \PackageWarning{nfssext-cfr}{%
2582 Failed to patch font initialisation macro for typewriter.%
2583 }%
2584 }
2585 % \end{macrocode}
2586 % END
2587 % \end{package}
2588 % \iffalse
2589 %</sty-nnfss>
2590 % \fi
2591 %
2592 % \subsection{NFSS}\label{subsec:sty-nfss}
2593 %
2594 % This code was written for the \emph{old} New Font Selection Scheme (\nfss).
2595 % It should not generally be loaded on current or recent kernels.
2596 %
2597 % \iffalse
2598 %<*sty-nfss>
2599 % \fi
2600 % \begin{package}{nfssext-cfr-nfss}
2601 % \begin{macrocode}
2602 \NeedsTeXFormat{LaTeX2e}
2603 \RequirePackage{svn-prov}
2604 \ProvidesPackageSVN[\filebase-nfss.sty]{$Id: nfssext-cfr.dtx 11042 2025-06-22 22:34:34Z cfrees $}[v1.3 \revinfo{} specially mangled by cfr; based on 2003/03/14 v1.2 Experimental NFSS Extensions; for old NFSS]
2605 \DefineFileInfoSVN
2606 % \end{macrocode}
2607 % ^^A Paid â defnyddio \GetFileInfoSVN*/\GetFileInfoSVN{} yn y fan hon!!
2608 %:cfr-added: use ifthen
2609 % \begin{macrocode}
2610 \RequirePackage{ifthen}
2611 % \end{macrocode}
2612 %:end-added
2613 % \begin{macro}{\exfs@tempa,\exfs@tempb,\exfs@tempf}
2614 % \begin{macrocode}
2615 \newcommand*{\exfs@tempa}{}
2616 \newcommand*{\exfs@tempb}{}
2617 % \end{macrocode}
2618 %:cfr-added: extra variable (\cs{exfs@tempf})
2619 % \begin{macrocode}
2620 \newcommand*{\exfs@tempf}{}
2621 % \end{macrocode}
2622 % \end{macro}
2623 %:end-added
2624 % \begin{macro}{\exfs@try@family}
2625 % \mbox{ }
2626 % \begin{macrocode}
2627 \newcommand*{\exfs@try@family}[2][]{%
2628 \let\exfs@tempa\relax
2629 \begingroup
2630 \fontfamily{#2}\try@load@fontshape
2631 \expandafter\ifx\csname\curr@fontshape\endcsname\relax
2632 \edef\exfs@tempa{#1}%
2633 \ifx\exfs@tempa\@empty
2634 \PackageWarning{nfssext}{%
2635 Font family '\f@encoding/#2' not available\MessageBreak
2636 Ignoring font switch}%
2637 \else
2638 \PackageInfo{nfssext}{%
2639 Font family '\f@encoding/#2' not available\MessageBreak
2640 Font family '\f@encoding/#1' tried instead}%
2641 \exfs@try@family{#1}%
2642 \fi
2643 \else
2644 \gdef\exfs@tempa{\fontfamily{#2}\selectfont}%
2645 \fi
2646 \endgroup
2647 \exfs@tempa}
2648 % \end{macrocode}
2649 % \end{macro}
2650 % \begin{macro}{\exfs@try@series}
2651 %:cfr-added \cs{exfs@try@series}
2652 % \begin{macrocode}
2653 \newcommand*{\exfs@try@series}[2][]{%
2654 \let\exfs@tempa\relax
2655 \begingroup
2656 \fontseries{#2}\try@load@fontshape
2657 \expandafter\ifx\csname\curr@fontshape\endcsname\relax
2658 \edef\exfs@tempa{#1}%
2659 \ifx\exfs@tempa\@empty
2660 \PackageWarning{nfssext-cfr}{%
2661 Font series '\f@encoding/\f@family/#2' not available\MessageBreak
2662 Ignoring font switch}%
2663 \else
2664 \PackageInfo{nfssext-cfr}{%
2665 Font family '\f@encoding/\f@family/#2' not available\MessageBreak
2666 Font family '\f@encoding/\f@family/#1' tried instead}%
2667 \exfs@try@series{#1}%
2668 \fi
2669 \else
2670 \gdef\exfs@tempa{\fontseries{#2}\selectfont}%
2671 \fi
2672 \endgroup
2673 \exfs@tempa
2674 }
2675 % \end{macrocode}
2676 %:end-added
2677 % \end{macro}
2678 % \begin{macro}{\exfs@get@base,\exfs@get@variants,\exfs@next,\exfs@shift,\exfs@first,\exfs@part,\exfs@second}
2679 % \mbox{ }
2680 % \begin{macrocode}
2681 \def\exfs@get@base#1#2#3#4\@nil{#1#2#3}
2682 % \end{macrocode}
2683 %:cfr-added:more \cs{exfs@} commands (get@variants, next, shift, first, part, second)
2684 % \begin{macrocode}
2685 \def\exfs@get@variants#1#2#3#4\@nil{#4}
2686 \def\exfs@next#1#2\@nil{#1}
2687 \def\exfs@shift#1#2\@nil{#2}
2688 \def\exfs@first#1#2\@nil{#1}
2689 \def\exfs@part#1#2\@nil{#2}
2690 \def\exfs@second#1#2#3\@nil{#2}
2691 % \end{macrocode}
2692 %:end-added
2693 % \end{macro}
2694 % \begin{macro}{\lnstyle,\osstyle,\infstyle,\instyle,\sustyle,\swstyle}
2695 % \mbox{ }
2696 % \begin{macrocode}
2697 \DeclareRobustCommand{\lnstyle}{%
2698 \not@math@alphabet\lnstyle\relax
2699 \exfs@try@family[\expandafter\exfs@get@base\f@family\@nil]%
2700 {\expandafter\exfs@get@base\f@family\@nil x}%
2701 }
2702 \DeclareRobustCommand{\osstyle}{%
2703 \not@math@alphabet\osstyle\relax
2704 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil j}}
2705 \DeclareRobustCommand{\instyle}{%
2706 \not@math@alphabet\instyle\relax
2707 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 0}}
2708 \DeclareRobustCommand{\sustyle}{%
2709 \not@math@alphabet\sustyle\relax
2710 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 1}}
2711 \DeclareRobustCommand{\swstyle}{%
2712 \not@math@alphabet\swstyle\relax
2713 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil w}}
2714 % \end{macrocode}
2715 % \end{macro}
2716 % \begin{macro}{\exfs@merge@families}
2717 %:cfr-added - merge families
2718 % \begin{macrocode}
2719 \newcommand*\exfs@merge@families[1]{%
2720 \edef\exfs@tempf{#1}%
2721 \edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
2722 \edef\tempo{2j}%
2723 \let\exfs@tempq\@empty
2724 \def\exfs@tempg{}%
2725 \newif\ifadded
2726 \addedfalse
2727 % \end{macrocode}
2728 % check whether there are variants - if not just use the requested addition
2729 % \begin{macrocode}
2730 \ifx\tempa\@empty
2731 \edef\exfs@tempq{\exfs@tempf}%
2732 \addedtrue
2733 \else
2734 \gdef\set{0,1,2,a,d,e,f,h,j,l,p,q,s,t,v,w}% these are the variants to consider - the order here and in the font name is crucial
2735 \ifx\tempo\exfs@tempf
2736 \@for \xx:=\set \do {%
2737 % \end{macrocode}
2738 % check whether there are variants left - if not set the ‘next variant’ to empty
2739 % \begin{macrocode}
2740 \ifx\tempa\@empty
2741 \let\exfs@tempn\@empty
2742 \else
2743 % \end{macrocode}
2744 % o/w get the next variant
2745 % \begin{macrocode}
2746 \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
2747 \fi
2748 \edef\tempt{2}%
2749 \edef\tempj{j}%
2750 % \end{macrocode}
2751 % if the next variant is 2 or j, ignore it
2752 % \begin{macrocode}
2753 \ifx\exfs@tempn\tempt
2754 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
2755 \fi
2756 \ifx\exfs@tempn\tempj % if the next variant is j, ignore it
2757 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
2758 \fi
2759 % \end{macrocode}
2760 % see if the current value is either 2 or j and add it if so and if needed
2761 % \begin{macrocode}
2762 \ifx\tempt\xx
2763 \edef\exfs@tempg{\exfs@tempg\xx}%
2764 \else
2765 \ifx\tempj\xx % if the current value is j, we're done
2766 \edef\exfs@tempq{\exfs@tempg\xx\tempa}%
2767 \let\tempa\@empty
2768 \addedtrue
2769 \else
2770 % \end{macrocode}
2771 % o/w see if the current value matches the next variant
2772 % \begin{macrocode}
2773 \ifx\xx\exfs@tempn
2774 \edef\exfs@tempg{\exfs@tempg\xx}%
2775 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
2776 \fi
2777 \fi
2778 \fi
2779 }%
2780 \else
2781 \@for \xx:=\set \do {%
2782 % \end{macrocode}
2783 % check whether there are variants left and, if not, add the addition if needed
2784 % \begin{macrocode}
2785 \ifx\tempa\@empty
2786 \ifadded
2787 \else
2788 \edef\exfs@tempq{\exfs@tempg\exfs@tempf}%
2789 \addedtrue
2790 \fi
2791 \else
2792 % \end{macrocode}
2793 % o/w get the next variant
2794 % \begin{macrocode}
2795 \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
2796 % \end{macrocode}
2797 % if the new token equals the next variant, combine whatever is saved in \cs{exfs@tempg} with whatever remains in \cs{tempa}
2798 % \begin{macrocode}
2799 \ifx\exfs@tempn\exfs@tempf
2800 \edef\exfs@tempq{\exfs@tempg\tempa}%
2801 \addedtrue
2802 \let\tempa\@empty
2803 \else
2804 % \end{macrocode}
2805 % o/w, if the current value matches the requested addition, add it in
2806 % \begin{macrocode}
2807 \ifx\exfs@tempf\xx
2808 \edef\exfs@tempq{\exfs@tempg\xx\tempa}%
2809 \addedtrue
2810 \let\tempa\@empty
2811 \else
2812 % \end{macrocode}
2813 % o/w, if the current value matches the next variant, shift
2814 % \begin{macrocode}
2815 \ifx\exfs@tempn\xx
2816 \edef\exfs@tempg{\exfs@tempg\xx}%
2817 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
2818 \fi
2819 \fi
2820 \fi
2821 \fi
2822 }%
2823 \fi
2824 \fi
2825 \ifx\exfs@tempq\@empty
2826 \PackageError{nfssext-cfr}{Something is wrong here. Ignoring font switching command.}{}%
2827 \else
2828 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
2829 \fi
2830 }
2831 % \end{macrocode}
2832 % \end{macro}
2833 % \begin{macro}{\pstyle,\ostyle,\postyle,\tistyle}
2834 % \begin{macrocode}
2835 \DeclareRobustCommand{\pstyle}{% proportional figures
2836 \not@math@alphabet\pstyle\relax
2837 \exfs@merge@families{2}}
2838 \DeclareRobustCommand{\tistyle}{% titling/display
2839 \not@math@alphabet\tistyle\relax
2840 \exfs@merge@families{d}}
2841 \DeclareRobustCommand{\ostyle}{% oldstyle figures (cf. original osstyle above)
2842 \not@math@alphabet\ostyle\relax
2843 \exfs@merge@families{j}}
2844 % \end{macrocode}
2845 % combined command for proportional oldstyle
2846 % \begin{macrocode}
2847 \DeclareRobustCommand{\postyle}{%
2848 \not@math@alphabet\postyle\relax
2849 \exfs@merge@families{2j}}
2850 % \end{macrocode}
2851 % \end{macro}
2852 % \begin{macro}{\ltstyle,\ofstyle,\altstyle,\regstyle,\embossstyle,\ornamentalstyle,\swashstyle,\shstyle,\qtstyle}
2853 %note that this command is for use when the light version is a separate family rather than a weight variant (e.g. when you've got light, light bold etc. as well as regular weights)
2854 % \begin{macrocode}
2855 \DeclareRobustCommand{\ltstyle}{%
2856 \not@math@alphabet\ltstyle\relax
2857 \exfs@merge@families{l}}
2858 % \end{macrocode}
2859 %let's hope there aren't any fonts with a light family *and* an outline/openface/blank version
2860 % \begin{macrocode}
2861 \DeclareRobustCommand{\ofstyle}{%
2862 \not@math@alphabet\ofstyle\relax
2863 \exfs@merge@families{l}}
2864 \DeclareRobustCommand{\altstyle}{% alternative style
2865 \not@math@alphabet\altstyle\relax
2866 \exfs@merge@families{a}}
2867 \DeclareRobustCommand{\regstyle}{% ``regular'' style
2868 \not@math@alphabet\regstyle\relax
2869 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil}}
2870 \DeclareRobustCommand{\embossstyle}{%
2871 \not@math@alphabet\embossstyle\relax
2872 \exfs@merge@families{e}}
2873 \DeclareRobustCommand{\ornamentalstyle}{% intended primarily for decorative initial fonts etc.
2874 \not@math@alphabet\ornamentalstyle\relax
2875 \exfs@merge@families{p}}
2876 \DeclareRobustCommand{\qtstyle}{% quotation style (assumes sans)
2877 \not@math@alphabet\qtstyle\relax
2878 \sffamily
2879 \exfs@merge@families{q}}
2880 \DeclareRobustCommand{\shstyle}{%
2881 \not@math@alphabet\shstyle\relax
2882 \exfs@merge@families{h}}
2883 \DeclareRobustCommand{\swashstyle}{% an attempt to improve on \swstyle
2884 \not@math@alphabet\swashstyle\relax
2885 \exfs@merge@families{w}}
2886 % \end{macrocode}
2887 % \end{macro}
2888 % \begin{macro}{\tmstyle,\tvstyle}
2889 % Macros to switch between monowidth and variable typewriter.
2890 % These need to unmerge before merging.
2891 % We need to unmerge sans as well as the other kind of typewriter.
2892 % \begin{macrocode}
2893 \DeclareRobustCommand{\tmstyle}{% monowidth typewriter
2894 \not@math@alphabet\tmstyle\relax
2895 \exfs@unmerge@families{s}%
2896 \exfs@unmerge@families{v}%
2897 \exfs@merge@families{t}}
2898 \DeclareRobustCommand{\tvstyle}{% variable width typewriter
2899 \not@math@alphabet\tvstyle\relax
2900 \exfs@unmerge@families{s}%
2901 \exfs@unmerge@families{t}%
2902 \exfs@merge@families{v}}
2903 % \end{macrocode}
2904 % \end{macro}
2905 % \begin{macro}{\exfs@unmerge@families}
2906 %:cfr-added - unmerge families
2907 % \begin{macrocode}
2908 \newcounter{taken}%
2909 \newcommand*\exfs@unmerge@families[1]{%
2910 \edef\exfs@tempf{#1}%
2911 \edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
2912 \let\exfs@tempq\@empty
2913 \edef\exfs@tempg{}%
2914 \setcounter{taken}{0}%
2915 % \end{macrocode}
2916 % check whether there are variants - if not do nothing
2917 % \begin{macrocode}
2918 \ifx\tempa\@empty
2919 \edef\exfs@tempq{}%
2920 \else
2921 % \end{macrocode}
2922 % o/w go through the variants to find the one to delete
2923 % \begin{macrocode}
2924 \whiledo{\value{taken}<1}{%
2925 % \end{macrocode}
2926 % get the next variant
2927 % \begin{macrocode}
2928 \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
2929 % \end{macrocode}
2930 % see if the next variant is the thing we seek and, if so, eliminate it
2931 % \begin{macrocode}
2932 \ifx\exfs@tempf\exfs@tempn
2933 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
2934 \edef\exfs@tempq{\exfs@tempg\tempa}%
2935 \stepcounter{taken}%
2936 % \end{macrocode}
2937 % o/w save the next variant and move on if any variants remain
2938 % \begin{macrocode}
2939 \else
2940 \edef\exfs@tempg{\exfs@tempg\exfs@tempn}%
2941 \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
2942 \ifx\tempa\@empty% if there are no variants left, we're done
2943 \edef\exfs@tempq{\exfs@tempg}%
2944 \stepcounter{taken}%
2945 \fi
2946 \fi
2947 }%
2948 \fi
2949 \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
2950 }
2951 % \end{macrocode}
2952 % \end{macro}
2953 % \begin{macro}{\tstyle,\lstyle}
2954 % \mbox{ }
2955 % \begin{macrocode}
2956 \DeclareRobustCommand{\tstyle}{% tabular figures
2957 \not@math@alphabet\tstyle\relax
2958 \exfs@unmerge@families{2}}
2959 \DeclareRobustCommand{\lstyle}{% lining figures (cf. command above)
2960 \not@math@alphabet\lstyle\relax
2961 \exfs@unmerge@families{j}}
2962 % \end{macrocode}
2963 % \end{macro}
2964 % \begin{macro}{\tlstyle,\plstyle,\tostyle}
2965 % make a combined command for tabular lining
2966 % \begin{macrocode}
2967 \DeclareRobustCommand{\tlstyle}{%
2968 \lstyle\tstyle}
2969 % \end{macrocode}
2970 % proportional lining
2971 % \begin{macrocode}
2972 \DeclareRobustCommand{\plstyle}{%
2973 \lstyle\pstyle}
2974 % \end{macrocode}
2975 % tabular oldstyle {?!}
2976 % \begin{macrocode}
2977 \DeclareRobustCommand{\tostyle}{%
2978 \ostyle\tstyle}
2979 % \end{macrocode}
2980 % \end{macro}
2981 % \begin{macro}{\sidefault,\sishape}
2982 %:end-added % si is italic sc
2983 % \begin{macrocode}
2984 \newcommand*{\sidefault}{si}
2985 \DeclareRobustCommand{\sishape}{%
2986 \not@math@alphabet\sishape\relax
2987 \fontshape\sidefault\selectfont}
2988 % \end{macrocode}
2989 % \end{macro}
2990 % \begin{macro}{\oldefault,\olshape,\scoldefault,\scolshape}
2991 %:cfr-added - is this how outline shapes should be handled?
2992 % \begin{macrocode}
2993 \newcommand*{\oldefault}{ol}
2994 \DeclareRobustCommand{\olshape}{%
2995 \not@math@alphabet\olshape\relax
2996 \fontshape\oldefault\selectfont}
2997 \newcommand*{\scoldefault}{scol}
2998 \DeclareRobustCommand{\scolshape}{%
2999 \not@math@alphabet\scolshape\relax
3000 \fontshape\scoldefault\selectfont}
3001 % \end{macrocode}
3002 %^^A\DeclareRobustCommand{\olshape}{%
3003 %^^A \not@math@alphabet\olshape\relax
3004 %^^A \exfs@merge@shape{\oldefault}{\scdefault}{\scoldefault}}
3005 % \end{macro}
3006 % \begin{macro}{\udefault,\ushape,\scudefault,\scushape}
3007 %:fudge
3008 % \begin{macrocode}
3009 \newcommand*{\udefault}{u}
3010 \DeclareRobustCommand{\ushape}{%
3011 \not@math@alphabet\ushape\relax
3012 \fontshape\udefault\selectfont}
3013 \newcommand*{\scudefault}{su}
3014 \DeclareRobustCommand{\scushape}{%
3015 \not@math@alphabet\scushape\relax
3016 \fontshape\scudefault\selectfont}
3017 % \end{macrocode}
3018 % \end{macro}
3019 % \begin{macro}{\uidefault,\uishape,\ridefault,\rishape}
3020 %:upright italic
3021 % \begin{macrocode}
3022 \newcommand*{\uidefault}{ui}
3023 \DeclareRobustCommand{\uishape}{%
3024 \not@math@alphabet\uishape\relax
3025 \fontshape\uidefault\selectfont}
3026 % \end{macrocode}
3027 %:can i do this for reverse italic?
3028 % \begin{macrocode}
3029 \newcommand*{\ridefault}{ri}
3030 \DeclareRobustCommand{\rishape}{%
3031 \not@math@alphabet\rishape\relax
3032 \fontshape\ridefault\selectfont}
3033 % \end{macrocode}
3034 % \end{macro}
3035 %:end-added
3036 % \begin{macro}{\exfs@merge@shape}
3037 % \mbox{ }
3038 % \begin{macrocode}
3039 \newcommand*{\exfs@merge@shape}[3]{%
3040 \edef\exfs@tempa{#1}%
3041 \edef\exfs@tempb{#2}%
3042 \ifx\f@shape\exfs@tempb
3043 \expandafter\ifx\csname\f@encoding/\f@family/\f@series/#3\endcsname\relax
3044 \else
3045 \edef\exfs@tempa{#3}%
3046 \fi
3047 \fi
3048 \fontshape{\exfs@tempa}\selectfont}
3049 % \end{macrocode}
3050 % \end{macro}
3051 % \begin{macro}{\exfs@font@width}
3052 %:cfr-added - merge width changes into series
3053 % \begin{macrocode}
3054 \newcommand*{\exfs@font@width}{%
3055 \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
3056 \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
3057 \ifx\exfs@temppart\@empty
3058 \def\exfs@width{}
3059 \else
3060 \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
3061 \ifx\exfs@temps{b}
3062 \edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
3063 \else
3064 \ifx\exfs@temps{l}
3065 \edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
3066 \else
3067 \edef\exfs@width{\exfs@temppart}%
3068 \fi
3069 \fi
3070 \fi
3071 \exfs@width
3072 }
3073 % \end{macrocode}
3074 % \end{macro}
3075 % \begin{macro}{\exfs@merge@width}
3076 % \mbox{ }
3077 % \begin{macrocode}
3078 \newcommand*{\exfs@merge@width}[1]{%
3079 \edef\exfs@temph{#1}%
3080 \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
3081 \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
3082 \def\tempb{b}%
3083 \def\templ{l}%
3084 \ifx\exfs@temppart\@empty
3085 \def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
3086 \else
3087 \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
3088 \ifx\exfs@temps\tempb
3089 \def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
3090 \else
3091 \ifx\exfs@temps\templ
3092 \def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
3093 \else
3094 \def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
3095 \fi
3096 \fi
3097 \fi
3098 \exfs@try@series{\exfs@series}%
3099 }
3100 %^^A \fontseries\exfs@series\selectfont}
3101 % \end{macrocode}
3102 % \end{macro}
3103 % \begin{macro}{\exfs@unmerge@width}
3104 % \mbox{ }
3105 % \begin{macrocode}
3106 \newcommand*{\exfs@unmerge@width}{%
3107 \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
3108 \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
3109 \def\tempb{b}%
3110 \def\templ{l}%
3111 \ifx\exfs@temppart\@empty
3112 \def\exfs@series{\expandafter\exfs@tempf}%
3113 \else
3114 \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
3115 \ifx\exfs@temps\tempb
3116 \def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
3117 \else
3118 \ifx\exfs@temps\templ
3119 \def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
3120 \else
3121 \def\exfs@series{\expandafter\exfs@tempf}%
3122 \fi
3123 \fi
3124 \fi
3125 \exfs@try@series{\exfs@series}%
3126 }
3127 % \end{macrocode}
3128 % \end{macro}
3129 % \begin{macro}{\regwidth}
3130 % \mbox{ }
3131 % \begin{macrocode}
3132 \DeclareRobustCommand{\regwidth}{%
3133 \not@math@alphabet\regwidth\relax
3134 \exfs@unmerge@width}
3135 % \end{macrocode}
3136 % \end{macro}
3137 % \begin{macro}{\nwdefault,\nwwidth,\cddefault,\cdwidth,\ecdefault,\ecwidth,\ucdefault,\ucwidth}
3138 % \mbox{ }
3139 % \begin{macrocode}
3140 \newcommand*{\nwdefault}{c}
3141 \DeclareRobustCommand{\nwwidth}{%
3142 \not@math@alphabet\nwwidth\relax
3143 \exfs@merge@width{\nwdefault}}
3144 \newcommand*{\cddefault}{c}
3145 \DeclareRobustCommand{\cdwidth}{%
3146 \not@math@alphabet\cdwidth\relax
3147 \exfs@merge@width{\cddefault}}
3148 \newcommand*{\ecdefault}{ec}
3149 \DeclareRobustCommand{\ecwidth}{%
3150 \not@math@alphabet\ecwidth\relax
3151 \exfs@merge@width{\ecdefault}}
3152 \newcommand*{\ucdefault}{uc}
3153 \DeclareRobustCommand{\ucwidth}{%
3154 \not@math@alphabet\ucwidth\relax
3155 \exfs@merge@width{\ucdefault}}
3156 % \end{macrocode}
3157 % \end{macro}
3158 % \begin{macro}{\etdefault,\etwidth,\epdefault,\epwidth,\exdefault,\exwidth,\uxdefault,\uxwidth}
3159 % \mbox{ }
3160 % \begin{macrocode}
3161 \newcommand*{\etdefault}{x}
3162 \DeclareRobustCommand{\etwidth}{%
3163 \not@math@alphabet\etwidth\relax
3164 \exfs@merge@width{\etdefault}}
3165 \newcommand*{\epdefault}{x}
3166 \DeclareRobustCommand{\epwidth}{%
3167 \not@math@alphabet\epwidth\relax
3168 \exfs@merge@width{\epdefault}}
3169 \newcommand*{\exdefault}{ex}
3170 \DeclareRobustCommand{\exwidth}{%
3171 \not@math@alphabet\exwidth\relax
3172 \exfs@merge@width{\exdefault}}
3173 \newcommand*{\uxdefault}{ux}
3174 \DeclareRobustCommand{\uxwidth}{%
3175 \not@math@alphabet\uxwidth\relax
3176 \exfs@merge@width{\uxdefault}}
3177 % \end{macrocode}
3178 % \end{macro}
3179 % \begin{macro}{\exfs@merge@weight}
3180 %:cfr-added merge weight changes into series
3181 % \begin{macrocode}
3182 \newcommand*{\exfs@merge@weight}[1]{%
3183 \edef\exfs@tempg{#1}%
3184 \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
3185 \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
3186 \def\templ{l}%
3187 \def\tempb{b}%
3188 % \end{macrocode}
3189 % :case when there's no second part, so the single character must be the weight and should be replaced
3190 % \begin{macrocode}
3191 \ifx\exfs@temppart\@empty
3192 \def\exfs@series{\expandafter\exfs@tempg}%
3193 % \end{macrocode}
3194 % :case when there's a second part
3195 % \begin{macrocode}
3196 \else
3197 % \end{macrocode}
3198 % :get first character of second part
3199 % \begin{macrocode}
3200 \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
3201 \edef\exfs@tempw{\expandafter\exfs@part\exfs@temps\@nil }%
3202 % \end{macrocode}
3203 % :is the first character b? if so, it is part of the weight and should be replaced
3204 % \begin{macrocode}
3205 \ifx\exfs@temps\tempb
3206 \def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
3207 \else
3208 % \end{macrocode}
3209 % :is the first character l? if so, it is part of the weight and should be replaced
3210 % \begin{macrocode}
3211 \ifx\exfs@temps\templ
3212 \def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
3213 \else
3214 % \end{macrocode}
3215 % :o/w the first character is part of the width and should be retained
3216 % \begin{macrocode}
3217 \def\exfs@series{\expandafter\exfs@tempg\exfs@temppart}%
3218 \fi
3219 \fi
3220 \fi
3221 % \end{macrocode}
3222 %^^A \fontseries\exfs@series\selectfont}
3223 % \begin{macrocode}
3224 \ifx\exfs@tempg\exfs@series
3225 \exfs@try@series{\exfs@series}%
3226 \else
3227 \exfs@try@series[\exfs@tempg]{\exfs@series}% assume user wants to change weight even if this changes back to the default width
3228 \fi
3229 }
3230 % \end{macrocode}
3231 % \end{macro}
3232 % \begin{macro}{\mbdefault,\mbweight,\bddefault,\bfweight,\bdweight}
3233 % \begin{macrocode}
3234 \newcommand*{\mbdefault}{mb}
3235 \DeclareRobustCommand{\mbweight}{%
3236 \not@math@alphabet\mbweight\relax
3237 \exfs@merge@weight{\mbdefault}}
3238 % \end{macrocode}
3239 % \end{macro}
3240 % \begin{macro}{\dbdefault,\dbweight,\sbdefault,\sbweight,\ebdefault,\ebweight,\ubdefault,\ubweight}
3241 % Heavy weights.
3242 % \begin{macrocode}
3243 \newcommand*{\dbdefault}{db}
3244 \DeclareRobustCommand{\dbweight}{%
3245 \not@math@alphabet\dbweight\relax
3246 \exfs@merge@weight{\dbdefault}}
3247 \newcommand*{\sbdefault}{sb}
3248 \DeclareRobustCommand{\sbweight}{%
3249 \not@math@alphabet\sbweight\relax
3250 \exfs@merge@weight{\sbdefault}}
3251 \newcommand*{\ebdefault}{eb}
3252 \DeclareRobustCommand{\ebweight}{%
3253 \not@math@alphabet\ebweight\relax
3254 \exfs@merge@weight{\ebdefault}}
3255 \newcommand*{\ubdefault}{ub}
3256 \DeclareRobustCommand{\ubweight}{%
3257 \not@math@alphabet\ubweight\relax
3258 \exfs@merge@weight{\ubdefault}}
3259 \newcommand*{\lgdefault}{l}
3260 % \end{macrocode}
3261 % \end{macro}
3262 % \begin{macro}{\lgdefault,\lgweight,\eldefault,\elweight,\uldefault,\ulweight}
3263 %note - use this if light is a variant weight, rather than a separate family
3264 % \begin{macrocode}
3265 \DeclareRobustCommand{\lgweight}{%
3266 \not@math@alphabet\lgweight\relax
3267 \exfs@merge@weight{\lgdefault}}
3268 \newcommand*{\eldefault}{el}
3269 \DeclareRobustCommand{\elweight}{%
3270 \not@math@alphabet\elweight\relax
3271 \exfs@merge@weight{\eldefault}}
3272 \newcommand*{\uldefault}{ul}
3273 \DeclareRobustCommand{\ulweight}{%
3274 \not@math@alphabet\ulweight\relax
3275 \exfs@merge@weight{\uldefault}}
3276 % \end{macrocode}
3277 % \end{macro}
3278 %:end-added
3279 % \begin{macro}{\itshape,\scshape,\upshape,\dfshape}
3280 % redefinition
3281 % \begin{macrocode}
3282 \DeclareRobustCommand{\itshape}{%
3283 \not@math@alphabet\itshape\mathit
3284 \exfs@merge@shape{\itdefault}{\scdefault}{\sidefault}}
3285 % \end{macrocode}
3286 % original
3287 %^^A\DeclareRobustCommand{\scshape}{%
3288 %^^A \not@math@alphabet\scshape\relax
3289 %^^A \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}}
3290 %:cfr-altered: \cs{scshape}
3291 % \begin{macrocode}
3292 \DeclareRobustCommand{\scshape}{%
3293 \not@math@alphabet\scshape\relax
3294 \def\tempu{u}%
3295 \def\tempo{ol}%
3296 \ifx\f@shape\tempu
3297 \exfs@merge@shape{\scdefault}{\udefault}{\scudefault}%
3298 \else
3299 \ifx\f@shape\tempo
3300 \exfs@merge@shape{\scdefault}{\oldefault}{\scoldefault}%
3301 \else
3302 \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}%
3303 \fi
3304 \fi
3305 }
3306 % \end{macrocode}
3307 %:end-altered
3308 % \begin{macrocode}
3309 \DeclareRobustCommand{\upshape}{%
3310 \not@math@alphabet\upshape\relax
3311 \exfs@merge@shape{\updefault}{\sidefault}{\scdefault}}
3312 \DeclareRobustCommand{\dfshape}{%
3313 \not@math@alphabet\dfshape\relax
3314 \fontshape\shapedefault\selectfont}
3315 % \end{macrocode}
3316 % \end{macro}
3317 % \begin{macro}{\swashapedefault,\swshape}
3318 % \begin{macrocode}
3319 \newcommand*{\swshapedefault}{\itdefault}
3320 \DeclareRobustCommand{\swshape}{%
3321 \not@math@alphabet\swshape\relax
3322 \swstyle\fontshape\swshapedefault\selectfont}
3323 % \end{macrocode}
3324 % \end{macro}
3325 % \begin{macro}{\textln,\textos,\textin,\textsu,\textsi,\textdf,\textsw}
3326 % \mbox{ }
3327 % \begin{macrocode}
3328 \DeclareTextFontCommand{\textln}{\lnstyle}
3329 \DeclareTextFontCommand{\textos}{\osstyle}
3330 \DeclareTextFontCommand{\textin}{\instyle}
3331 \DeclareTextFontCommand{\textsu}{\sustyle}
3332 \DeclareTextFontCommand{\textsi}{\sishape}
3333 \DeclareTextFontCommand{\textdf}{\dfshape}
3334 \DeclareTextFontCommand{\textsw}{\swshape}
3335 % \end{macrocode}
3336 % \end{macro}
3337 %:cfr-added
3338 % \begin{macro}{\textti,\textlt,\textof,\textalt,\textreg,\emboss,\textorn,\textqt,\textsh,\texttm,\texttv}
3339 % Families
3340 % \begin{macrocode}
3341 \DeclareTextFontCommand{\textti}{\tistyle}
3342 \DeclareTextFontCommand{\textlt}{\ltstyle}
3343 \DeclareTextFontCommand{\textof}{\ofstyle} % open-face (or outline or blank) style
3344 \DeclareTextFontCommand{\textalt}{\altstyle} % alternative style
3345 \DeclareTextFontCommand{\textreg}{\regstyle} % ``regular'' style
3346 \DeclareTextFontCommand{\emboss}{\embossstyle}
3347 \DeclareTextFontCommand{\textorn}{\ornamentalstyle} % intended primarily for decorative initials etc.
3348 \DeclareTextFontCommand{\textqt}{\qtstyle}
3349 \DeclareTextFontCommand{\textsh}{\shstyle} % shadowed style
3350 \DeclareTextFontCommand{\texttm}{\tmstyle}
3351 \DeclareTextFontCommand{\texttv}{\tvstyle}
3352 % \end{macrocode}
3353 % \end{macro}
3354 % \begin{macro}{\textl,\texto,\textp,\textt,\textpl,\textpo,\texttl,\textto}
3355 % Families - figures
3356 % \begin{macrocode}
3357 \DeclareTextFontCommand{\textl}{\lstyle}
3358 \DeclareTextFontCommand{\texto}{\ostyle}
3359 \DeclareTextFontCommand{\textp}{\pstyle}
3360 \DeclareTextFontCommand{\textt}{\tstyle}
3361 \DeclareTextFontCommand{\textpl}{\plstyle}
3362 \DeclareTextFontCommand{\textpo}{\postyle}
3363 \DeclareTextFontCommand{\texttl}{\tlstyle}
3364 \DeclareTextFontCommand{\textto}{\tostyle}
3365 % \end{macrocode}
3366 % \end{macro}
3367 % \begin{macro}{\textol,\textswash,\textu,\textscu,\textui,\textri}
3368 % Shapes
3369 % \begin{macrocode}
3370 \DeclareTextFontCommand{\textol}{\olshape} % outline
3371 \DeclareTextFontCommand{\textswash}{\swashstyle} % an attempt to improve on \textsw
3372 \DeclareTextFontCommand{\textu}{\ushape}
3373 \DeclareTextFontCommand{\textscu}{\scushape}
3374 \DeclareTextFontCommand{\textui}{\uishape} % upright italic
3375 \DeclareTextFontCommand{\textri}{\rishape} % reverse italic
3376 % \end{macrocode}
3377 % \end{macro}
3378 % \begin{macro}{\textnw,\textcd,\textec,\textuc,\textet,\textep,\textex,\textux,\textrw}
3379 % Widths
3380 % \begin{macrocode}
3381 \DeclareTextFontCommand{\textnw}{\nwwidth}
3382 \DeclareTextFontCommand{\textcd}{\cdwidth}
3383 \DeclareTextFontCommand{\textec}{\ecwidth}
3384 \DeclareTextFontCommand{\textuc}{\ucwidth}
3385 \DeclareTextFontCommand{\textet}{\etwidth}
3386 \DeclareTextFontCommand{\textep}{\epwidth}
3387 \DeclareTextFontCommand{\textex}{\exwidth}
3388 \DeclareTextFontCommand{\textux}{\uxwidth}
3389 \DeclareTextFontCommand{\textrw}{\regwidth}
3390 % \end{macrocode}
3391 % \end{macro}
3392 % \begin{macro}{\textmb,\textdb,\textbd,\textsb,\texteb,\textub,\textlg,\textel,\textul}
3393 % Weights
3394 % \begin{macrocode}
3395 \DeclareTextFontCommand{\textmb}{\mbweight}
3396 \DeclareTextFontCommand{\textdb}{\dbweight}
3397 \DeclareTextFontCommand{\textsb}{\sbweight}
3398 \DeclareTextFontCommand{\texteb}{\ebweight}
3399 \DeclareTextFontCommand{\textub}{\ubweight}
3400 \DeclareTextFontCommand{\textlg}{\lgweight}
3401 \DeclareTextFontCommand{\textel}{\elweight}
3402 \DeclareTextFontCommand{\textul}{\ulweight}
3403 % \end{macrocode}
3404 % \end{macro}
3405 %end-added
3406 % \end{package}
3407 % \iffalse
3408 %</sty-nfss>
3409 % \fi
3410 %
3411 %
3412 %\Finale