summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nfssext-cfr/nfssext-cfr.sty
blob: 03d19d2e59547d07cc729e341c03f3dccf5445e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
%% nfssext-cfr.sty
%% Additions and changes are copyright 2017 Clea F. Rees
%% Code from nfssext.sty copyright 2003 Philipp Lehman (see below)
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Clea F. Rees.
%
% This work consists of the file nfssext-cfr.sty.
%
% The file nfssext-cfr.sty is a derived work under the terms of the
% LPPL. It is based on version 1.2 of nfssext.sty which is part of The
% Font Installation Guide by Philipp Lehman. A copy of the The Font
% Installation Guide, including the unmodified version of nfssext.sty
% is available from
% http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=fontinstallationguide.
% nfssext.sty is part of the included archive figuide-examples.tar.gz
% which consists of examples and templates released under the LPPL.
% nfssext.sty is included in the files for tutorials 3, 5 and 6.
%
% 2017-03-28: modify \tmstyle and \tvstyle to unmerge sans and other
% typewriter before mergining appropriate variant
%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{svn-prov}
\ProvidesPackageSVN{$Id: nfssext-cfr.sty 6140 2017-03-28 18:07:31Z cfrees $}[\revinfo{} specially mangled by cfr; based on 2003/03/14 v1.2 Experimental NFSS Extensions]
%:cfr-added: use ifthen
\RequirePackage{ifthen}
%:end-added
\newcommand*{\exfs@tempa}{}
\newcommand*{\exfs@tempb}{}
%:cfr-added: extra variable (\exfs@tempf)
\newcommand*{\exfs@tempf}{}
%:end-added
\newcommand*{\exfs@try@family}[2][]{%
  \let\exfs@tempa\relax
  \begingroup
    \fontfamily{#2}\try@load@fontshape
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
      \edef\exfs@tempa{#1}%
      \ifx\exfs@tempa\@empty
        \PackageWarning{nfssext}{%
          Font family '\f@encoding/#2' not available\MessageBreak
          Ignoring font switch}%
      \else
        \PackageInfo{nfssext}{%
          Font family '\f@encoding/#2' not available\MessageBreak
          Font family '\f@encoding/#1' tried instead}%
        \exfs@try@family{#1}%
      \fi
    \else
      \gdef\exfs@tempa{\fontfamily{#2}\selectfont}%
    \fi
  \endgroup
  \exfs@tempa}
%:cfr-added exfs@try@series
\newcommand*{\exfs@try@series}[2][]{%
  \let\exfs@tempa\relax
  \begingroup
    \fontseries{#2}\try@load@fontshape
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
      \edef\exfs@tempa{#1}%
      \ifx\exfs@tempa\@empty
        \PackageWarning{nfssext-cfr}{%
          Font series '\f@encoding/\f@family/#2' not available\MessageBreak
          Ignoring font switch}%
      \else
        \PackageInfo{nfssext-cfr}{%
          Font family '\f@encoding/\f@family/#2' not available\MessageBreak
          Font family '\f@encoding/\f@family/#1' tried instead}%
        \exfs@try@series{#1}%
      \fi
    \else
      \gdef\exfs@tempa{\fontseries{#2}\selectfont}%
    \fi
  \endgroup
  \exfs@tempa}
%:end-added
\def\exfs@get@base#1#2#3#4\@nil{#1#2#3}
%:cfr-added:more \exfs@ commands (get@variants, next, shift, first, part, second)
\def\exfs@get@variants#1#2#3#4\@nil{#4}
\def\exfs@next#1#2\@nil{#1}
\def\exfs@shift#1#2\@nil{#2}
\def\exfs@first#1#2\@nil{#1}
\def\exfs@part#1#2\@nil{#2}
\def\exfs@second#1#2#3\@nil{#2}
%:end-added
\DeclareRobustCommand{\lnstyle}{%
  \not@math@alphabet\lnstyle\relax
  \exfs@try@family[\expandafter\exfs@get@base\f@family\@nil]%
                  {\expandafter\exfs@get@base\f@family\@nil x}}
\DeclareRobustCommand{\osstyle}{%
  \not@math@alphabet\osstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil j}}
\DeclareRobustCommand{\instyle}{%
  \not@math@alphabet\instyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 0}}
\DeclareRobustCommand{\sustyle}{%
  \not@math@alphabet\sustyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 1}}
\DeclareRobustCommand{\swstyle}{%
  \not@math@alphabet\swstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil w}}
%:cfr-added - merge families
\newcommand*\exfs@merge@families[1]{%
	\edef\exfs@tempf{#1}%
	\edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
	\edef\tempo{2j}%
	\let\exfs@tempq\@empty
	\def\exfs@tempg{}%
	\newif\ifadded
		\addedfalse
	% check whether there are variants - if not just use the requested addition
	\ifx\tempa\@empty
		\edef\exfs@tempq{\exfs@tempf}%
		\addedtrue
	\else
		\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
		\ifx\tempo\exfs@tempf
			\@for \xx:=\set \do {%
				% check whether there are variants left - if not set the ``next variant'' to empty
				\ifx\tempa\@empty
					\let\exfs@tempn\@empty
				\else
					% o/w get the next variant
					\edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
				\fi
				\edef\tempt{2}%
				\edef\tempj{j}%
				% if the next variant is 2 or j, ignore it
				\ifx\exfs@tempn\tempt
					\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\fi
				\ifx\exfs@tempn\tempj	% if the next variant is j, ignore it
						\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\fi
				% see if the current value is either 2 or j and add it if so and if needed
				\ifx\tempt\xx
					\edef\exfs@tempg{\exfs@tempg\xx}%
				\else
					\ifx\tempj\xx	% if the current value is j, we're done
						\edef\exfs@tempq{\exfs@tempg\xx\tempa}%
						\let\tempa\@empty
						\addedtrue
					\else
						% o/w see if the current value matches the next variant
						\ifx\xx\exfs@tempn
							\edef\exfs@tempg{\exfs@tempg\xx}%
							\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
						\fi
					\fi
				\fi
			}%
		\else
			\@for \xx:=\set \do {%
				% check whether there are variants left and, if not, add the addition if needed
				\ifx\tempa\@empty
					\ifadded
					\else
						\edef\exfs@tempq{\exfs@tempg\exfs@tempf}%
						\addedtrue
					\fi
				\else
					% o/w get the next variant
					\edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
						% if the new token equals the next variant, combine whatever is saved in \exfs@tempg with whatever remains in \tempa
					\ifx\exfs@tempn\exfs@tempf
						\edef\exfs@tempq{\exfs@tempg\tempa}%
						\addedtrue
						\let\tempa\@empty
					\else
						% o/w, if the current value matches the requested addition, add it in
						\ifx\exfs@tempf\xx
							\edef\exfs@tempq{\exfs@tempg\xx\tempa}%
							\addedtrue
							\let\tempa\@empty
						\else
							% o/w, if the current value matches the next variant, shift
							\ifx\exfs@tempn\xx
								\edef\exfs@tempg{\exfs@tempg\xx}%
								\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
							\fi
						\fi
					\fi
				\fi
			}%
		\fi
	\fi
	\ifx\exfs@tempq\@empty
		\PackageError{nfssext-cfr}{Something is wrong here. Ignoring font switching command.}{}%
	\else
	\exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
	\fi}
\DeclareRobustCommand{\pstyle}{%		proportional figures
	\not@math@alphabet\pstyle\relax
	\exfs@merge@families{2}}
\DeclareRobustCommand{\tistyle}{%	titling/display
	\not@math@alphabet\tistyle\relax
	\exfs@merge@families{d}}
\DeclareRobustCommand{\ostyle}{%		oldstyle figures (cf. original osstyle above)
	\not@math@alphabet\ostyle\relax
	\exfs@merge@families{j}}
% combined command for proportional oldstyle
\DeclareRobustCommand{\postyle}{%
	\not@math@alphabet\postyle\relax
	\exfs@merge@families{2j}}
%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)
\DeclareRobustCommand{\ltstyle}{%
	\not@math@alphabet\ltstyle\relax
	\exfs@merge@families{l}}
%let's hope there aren't any fonts with a light family *and* an outline/openface/blank version
\DeclareRobustCommand{\ofstyle}{%
	\not@math@alphabet\ofstyle\relax
	\exfs@merge@families{l}}
\DeclareRobustCommand{\altstyle}{%	alternative style
	\not@math@alphabet\altstyle\relax
	\exfs@merge@families{a}}
\DeclareRobustCommand{\regstyle}{% ``regular'' style
  \not@math@alphabet\regstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil}}
\DeclareRobustCommand{\embossstyle}{%
	\not@math@alphabet\embossstyle\relax
	\exfs@merge@families{e}}
\DeclareRobustCommand{\ornamentalstyle}{%	intended primarily for decorative initial fonts etc.
	\not@math@alphabet\ornamentalstyle\relax
	\exfs@merge@families{p}}
\DeclareRobustCommand{\qtstyle}{%	quotation style (assumes sans)
	\not@math@alphabet\qtstyle\relax
	\sffamily
	\exfs@merge@families{q}}
\DeclareRobustCommand{\shstyle}{%
	\not@math@alphabet\shstyle\relax
	\exfs@merge@families{h}}
\DeclareRobustCommand{\swashstyle}{%			an attempt to improve on \swstyle
	\not@math@alphabet\swashstyle\relax
	\exfs@merge@families{w}}
\DeclareRobustCommand{\tmstyle}{%       monowidth typewriter
  \not@math@alphabet\tmstyle\relax
  \exfs@unmerge@families{s}%
  \exfs@unmerge@families{v}%
  \exfs@merge@families{t}}
\DeclareRobustCommand{\tvstyle}{%       variable width typewriter
  \not@math@alphabet\tvstyle\relax
  \exfs@unmerge@families{s}%
  \exfs@unmerge@families{t}%
  \exfs@merge@families{v}}
%:cfr-added - unmerge families
\newcounter{taken}%
\newcommand*\exfs@unmerge@families[1]{%
	\edef\exfs@tempf{#1}%
	\edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
	\let\exfs@tempq\@empty
	\edef\exfs@tempg{}%
	\setcounter{taken}{0}%
	% check whether there are variants - if not do nothing
	\ifx\tempa\@empty
		\edef\exfs@tempq{}%
	\else
		% o/w go through the variants to find the one to delete
		\whiledo{\value{taken}<1}{%
			% get the next variant
			\edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
			% see if the next variant is the thing we seek and, if so, eliminate it
			\ifx\exfs@tempf\exfs@tempn
				\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\edef\exfs@tempq{\exfs@tempg\tempa}%
				\stepcounter{taken}%
			% o/w save the next variant and move on if any variants remain
			\else
				\edef\exfs@tempg{\exfs@tempg\exfs@tempn}%
				\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\ifx\tempa\@empty% if there are no variants left, we're done
					\edef\exfs@tempq{\exfs@tempg}%
					\stepcounter{taken}%
				\fi
			\fi
		}%
	\fi
	\exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}}
\DeclareRobustCommand{\tstyle}{%		tabular figures
	\not@math@alphabet\tstyle\relax
	\exfs@unmerge@families{2}}
\DeclareRobustCommand{\lstyle}{%		lining figures (cf. command above)
	\not@math@alphabet\lstyle\relax
	\exfs@unmerge@families{j}}
% make a combined command for tabular lining
\DeclareRobustCommand{\tlstyle}{%
	\lstyle\tstyle}
% proportional lining
\DeclareRobustCommand{\plstyle}{%
	\lstyle\pstyle}
% tabular oldstyle {?!}
\DeclareRobustCommand{\tostyle}{%
	\ostyle\tstyle}
%:end-added % si is italic sc
\newcommand*{\sidefault}{si}
\DeclareRobustCommand{\sishape}{%
  \not@math@alphabet\sishape\relax
  \fontshape\sidefault\selectfont}
%:cfr-added - is this how outline shapes should be handled?
\newcommand*{\oldefault}{ol}
\DeclareRobustCommand{\olshape}{%
	\not@math@alphabet\olshape\relax
	\fontshape\oldefault\selectfont}
\newcommand*{\scoldefault}{scol}
\DeclareRobustCommand{\scolshape}{%
	\not@math@alphabet\scolshape\relax
	\fontshape\scoldefault\selectfont}
%\DeclareRobustCommand{\olshape}{%
%  \not@math@alphabet\olshape\relax
%  \exfs@merge@shape{\oldefault}{\scdefault}{\scoldefault}}
%:fudge
\newcommand*{\udefault}{u}
\DeclareRobustCommand{\ushape}{%
	\not@math@alphabet\ushape\relax
	\fontshape\udefault\selectfont}
\newcommand*{\scudefault}{su}
\DeclareRobustCommand{\scushape}{%
	\not@math@alphabet\scushape\relax
	\fontshape\scudefault\selectfont}
%:upright italic
\newcommand*{\uidefault}{ui}
\DeclareRobustCommand{\uishape}{%
	\not@math@alphabet\uishape\relax
	\fontshape\uidefault\selectfont}
%:can i do this for reverse italic?
\newcommand*{\ridefault}{ri}
\DeclareRobustCommand{\rishape}{%
	\not@math@alphabet\rishape\relax
	\fontshape\ridefault\selectfont}
%:end-added
\newcommand*{\exfs@merge@shape}[3]{%
  \edef\exfs@tempa{#1}%
  \edef\exfs@tempb{#2}%
  \ifx\f@shape\exfs@tempb
    \expandafter\ifx\csname\f@encoding/\f@family/\f@series/#3\endcsname\relax
    \else
      \edef\exfs@tempa{#3}%
    \fi
  \fi
  \fontshape{\exfs@tempa}\selectfont}
%:cfr-added - merge width changes into series
\newcommand*{\exfs@font@width}{%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\ifx\exfs@temppart\@empty
		\def\exfs@width{}
	\else
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\ifx\exfs@temps{b}
			\edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
		\else
			\ifx\exfs@temps{l}
				\edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
			\else
				\edef\exfs@width{\exfs@temppart}%
			\fi
		\fi
	\fi
	\exfs@width
	}
\newcommand*{\exfs@merge@width}[1]{%
	\edef\exfs@temph{#1}%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\def\tempb{b}%
	\def\templ{l}%
	\ifx\exfs@temppart\@empty
		\def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
	\else
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\ifx\exfs@temps\tempb
			\def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
		\else
			\ifx\exfs@temps\templ
				\def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
			\else
				\def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
			\fi
		\fi
	\fi
	\exfs@try@series{\exfs@series}}
%	\fontseries\exfs@series\selectfont}
\newcommand*{\exfs@unmerge@width}{%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\def\tempb{b}%
	\def\templ{l}%
	\ifx\exfs@temppart\@empty
		\def\exfs@series{\expandafter\exfs@tempf}%
	\else
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\ifx\exfs@temps\tempb
			\def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
		\else
			\ifx\exfs@temps\templ
				\def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
			\else
				\def\exfs@series{\expandafter\exfs@tempf}%
			\fi
		\fi
	\fi
	\exfs@try@series{\exfs@series}}
\DeclareRobustCommand{\regwidth}{%
	\not@math@alphabet\regwidth\relax
	\exfs@unmerge@width}
\newcommand*{\nwdefault}{c}
\DeclareRobustCommand{\nwwidth}{%
	\not@math@alphabet\nwwidth\relax
	\exfs@merge@width{\nwdefault}}
\newcommand*{\cddefault}{c}
\DeclareRobustCommand{\cdwidth}{%
	\not@math@alphabet\cdwidth\relax
	\exfs@merge@width{\cddefault}}
\newcommand*{\ecdefault}{ec}
\DeclareRobustCommand{\ecwidth}{%
	\not@math@alphabet\ecwidth\relax
	\exfs@merge@width{\ecdefault}}
\newcommand*{\ucdefault}{uc}
\DeclareRobustCommand{\ucwidth}{%
	\not@math@alphabet\ucwidth\relax
	\exfs@merge@width{\ucdefault}}
\newcommand*{\etdefault}{x}
\DeclareRobustCommand{\etwidth}{%
	\not@math@alphabet\etwidth\relax
	\exfs@merge@width{\etdefault}}
\newcommand*{\epdefault}{x}
\DeclareRobustCommand{\epwidth}{%
	\not@math@alphabet\epwidth\relax
	\exfs@merge@width{\epdefault}}
\newcommand*{\exdefault}{ex}
\DeclareRobustCommand{\exwidth}{%
	\not@math@alphabet\exwidth\relax
	\exfs@merge@width{\exdefault}}
\newcommand*{\uxdefault}{ux}
\DeclareRobustCommand{\uxwidth}{%
	\not@math@alphabet\uxwidth\relax
	\exfs@merge@width{\uxdefault}}
%:cfr-added merge weight changes into series
\newcommand*{\exfs@merge@weight}[1]{%
	\edef\exfs@tempg{#1}%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\def\templ{l}%
	\def\tempb{b}%
	%:case when there's no second part, so the single character must be the weight and should be replaced
	\ifx\exfs@temppart\@empty
		\def\exfs@series{\expandafter\exfs@tempg}%
	%:case when there's a second part
	\else
		%:get first character of second part
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\edef\exfs@tempw{\expandafter\exfs@part\exfs@temps\@nil }%
		%:is the first character b? if so, it is part of the weight and should be replaced
		\ifx\exfs@temps\tempb
			\def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
		\else
			%:is the first character l? if so, it is part of the weight and should be replaced
			\ifx\exfs@temps\templ
				\def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
			\else
				%:o/w the first character is part of the width and should be retained
				\def\exfs@series{\expandafter\exfs@tempg\exfs@temppart}%
			\fi
		\fi
	\fi
	%\fontseries\exfs@series\selectfont}
	\ifx\exfs@tempg\exfs@series
		\exfs@try@series{\exfs@series}%
	\else
		\exfs@try@series[\exfs@tempg]{\exfs@series}%		assume user wants to change weight even if this changes back to the default width
	\fi}
\newcommand*{\mbdefault}{mb}
\DeclareRobustCommand{\mbweight}{%
	\not@math@alphabet\mbweight\relax
	\exfs@merge@weight{\mbdefault}}
\newcommand*{\dbdefault}{db}
\DeclareRobustCommand{\dbweight}{%
	\not@math@alphabet\dbweight\relax
	\exfs@merge@weight{\dbdefault}}
\newcommand*{\sbdefault}{sb}
\DeclareRobustCommand{\sbweight}{%
	\not@math@alphabet\sbweight\relax
	\exfs@merge@weight{\sbdefault}}
\newcommand*{\ebdefault}{eb}
\DeclareRobustCommand{\ebweight}{%
	\not@math@alphabet\ebweight\relax
	\exfs@merge@weight{\ebdefault}}
\newcommand*{\ubdefault}{ub}
\DeclareRobustCommand{\ubweight}{%
	\not@math@alphabet\ubweight\relax
	\exfs@merge@weight{\ubdefault}}
\newcommand*{\lgdefault}{l}
%note - use this if light is a variant weight, rather than a separate family
\DeclareRobustCommand{\lgweight}{%
	\not@math@alphabet\lgweight\relax
	\exfs@merge@weight{\lgdefault}}
\newcommand*{\eldefault}{el}
\DeclareRobustCommand{\elweight}{%
	\not@math@alphabet\elweight\relax
	\exfs@merge@weight{\eldefault}}
\newcommand*{\uldefault}{ul}
\DeclareRobustCommand{\ulweight}{%
	\not@math@alphabet\ulweight\relax
	\exfs@merge@weight{\uldefault}}
%:end-added
\DeclareRobustCommand{\itshape}{%
  \not@math@alphabet\itshape\mathit
  \exfs@merge@shape{\itdefault}{\scdefault}{\sidefault}}
% original
%\DeclareRobustCommand{\scshape}{%
%  \not@math@alphabet\scshape\relax
%  \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}}
%:cfr-altered: \scshape
\DeclareRobustCommand{\scshape}{%
  \not@math@alphabet\scshape\relax
  \def\tempu{u}%
  \def\tempo{ol}%
  \ifx\f@shape\tempu
  	\exfs@merge@shape{\scdefault}{\udefault}{\scudefault}%
  \else
  	\ifx\f@shape\tempo
		\exfs@merge@shape{\scdefault}{\oldefault}{\scoldefault}%
	\else
  		\exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}%
	\fi
  \fi}
%:end-altered
\DeclareRobustCommand{\upshape}{%
  \not@math@alphabet\upshape\relax
  \exfs@merge@shape{\updefault}{\sidefault}{\scdefault}}
\DeclareRobustCommand{\dfshape}{%
  \not@math@alphabet\dfshape\relax
  \fontshape\shapedefault\selectfont}
\newcommand*{\swshapedefault}{\itdefault}
\DeclareRobustCommand{\swshape}{%
  \not@math@alphabet\swshape\relax
  \swstyle\fontshape\swshapedefault\selectfont}
\DeclareTextFontCommand{\textln}{\lnstyle}
\DeclareTextFontCommand{\textos}{\osstyle}
\DeclareTextFontCommand{\textin}{\instyle}
\DeclareTextFontCommand{\textsu}{\sustyle}
\DeclareTextFontCommand{\textsi}{\sishape}
\DeclareTextFontCommand{\textdf}{\dfshape}
\DeclareTextFontCommand{\textsw}{\swshape}
%:cfr-added
%:families
\DeclareTextFontCommand{\textti}{\tistyle}
\DeclareTextFontCommand{\textlt}{\ltstyle}
\DeclareTextFontCommand{\textof}{\ofstyle}						% open-face (or outline or blank) style
\DeclareTextFontCommand{\textalt}{\altstyle}					% alternative style
\DeclareTextFontCommand{\textreg}{\regstyle}					% ``regular'' style
\DeclareTextFontCommand{\emboss}{\embossstyle}
\DeclareTextFontCommand{\textorn}{\ornamentalstyle}	% intended primarily for decorative initials etc.
\DeclareTextFontCommand{\textqt}{\qtstyle}
\DeclareTextFontCommand{\textsh}{\shstyle}						% shadowed style
\DeclareTextFontCommand{\texttm}{\tmstyle}
\DeclareTextFontCommand{\texttv}{\tvstyle}
%:families - figures
\DeclareTextFontCommand{\textl}{\lstyle}
\DeclareTextFontCommand{\texto}{\ostyle}
\DeclareTextFontCommand{\textp}{\pstyle}
\DeclareTextFontCommand{\textt}{\tstyle}
\DeclareTextFontCommand{\textpl}{\plstyle}
\DeclareTextFontCommand{\textpo}{\postyle}
\DeclareTextFontCommand{\texttl}{\tlstyle}
\DeclareTextFontCommand{\textto}{\tostyle}
%:shapes
\DeclareTextFontCommand{\textol}{\olshape}						% outline
\DeclareTextFontCommand{\textswash}{\swashstyle}		% an attempt to improve on \textsw
\DeclareTextFontCommand{\textu}{\ushape}
\DeclareTextFontCommand{\textscu}{\scushape}
\DeclareTextFontCommand{\textui}{\uishape}						% upright italic
\DeclareTextFontCommand{\textri}{\rishape}						% reverse italic
%:widths
\DeclareTextFontCommand{\textnw}{\nwwidth}
\DeclareTextFontCommand{\textcd}{\cdwidth}
\DeclareTextFontCommand{\textec}{\ecwidth}
\DeclareTextFontCommand{\textuc}{\ucwidth}
\DeclareTextFontCommand{\textet}{\etwidth}
\DeclareTextFontCommand{\textep}{\epwidth}
\DeclareTextFontCommand{\textex}{\exwidth}
\DeclareTextFontCommand{\textux}{\uxwidth}
\DeclareTextFontCommand{\textrw}{\regwidth}
%:weights
\DeclareTextFontCommand{\textmb}{\mbweight}
\DeclareTextFontCommand{\textdb}{\dbweight}
\DeclareTextFontCommand{\textsb}{\sbweight}
\DeclareTextFontCommand{\texteb}{\ebweight}
\DeclareTextFontCommand{\textub}{\ubweight}
\DeclareTextFontCommand{\textlg}{\lgweight}
\DeclareTextFontCommand{\textel}{\elweight}
\DeclareTextFontCommand{\textul}{\ulweight}
%end-added
\newcommand*{\DeclareTextOrnament}[7]{%
  \expandafter\def\csname#1@orn\@roman#2\endcsname{#3/#4/#5/#6/#7}}
\begingroup
  \catcode`\/=12
  \gdef\exfs@split@orndef#1/#2/#3/#4/#5\@nil{%
    \def\f@encoding{#1}%
    \def\f@family{#2}%
    \def\f@series{#3}%
    \def\f@shape{#4}%
    \def\exfs@tempa{#5}}
\endgroup
\def\exfs@base@family{\expandafter\exfs@get@base\f@family\@nil}
\DeclareRobustCommand{\ornament}[1]{%
  \expandafter\ifx\csname\exfs@base@family @orn\@roman#1\endcsname\relax
    \PackageWarning{nfssext}{%
      Ornament #1 undefined for font family '\exfs@base@family'\MessageBreak
      Setting debug mark}%
    \rule{1ex}{1ex}%
  \else
    \begingroup
      \edef\exfs@tempb{\csname\exfs@base@family @orn\@roman#1\endcsname}%
      \expandafter\expandafter\expandafter\exfs@split@orndef
        \expandafter\string\exfs@tempb\@nil
      \selectfont\char\exfs@tempa
    \endgroup
  \fi}
%:add microtype hooks
%:partly from microtype docs; partly from MinionPro package
\def\nfssextcfr@MT@Hook{%
%	\DeclareMicrotypeVariants{x,j,w,a,d,0,1}% this is the default declaration according to the docs
%	\DeclareMicrotypeVariants*{2,e,h,l}% this should *append* the variants (what do I use 'f' for? better take it out...)
	\DeclareMicrotypeVariants*{2,2d,2dj,2j,dj,e,h,l}% is this necessary or would the previous line be enough?
	}
\@ifpackageloaded{microtype}{%
  \nfssextcfr@MT@Hook}{%
  \@ifundefined{Microtype@Hook}{%
  	\let\Microtype@Hook\nfssextcfr@MT@Hook}{% MinionPro has \global before this
	\g@addto@macro\Microtype@Hook{\nfssextcfr@MT@Hook}}}
\endinput