blob: a8d78de7f406157cda90b9e19872c173641635df (
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
|
% csfontsm.tex, October 2012, Petr Olsak (Ol\v s\'ak)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file is a part of csplain used during format generation.
%
% Usage: \def\sizespec{at14pt}\resizefont\tenrm
% after this, the \tenrm font selector switches to csr10 at14pt
%
% The \resizefont macro takes the font selector declared by \font, uses the
% same font but re-sets this selector to (probably) new font size declared
% in the \sizespec macro. You can \def\sizespec{at<dimen>} or
% \def\sizespec{magstep<number>}. The \resizefont's setting is done
% locally, it means that you can do (for instance):
%
% {\def\sizespec{scaled\magstep3}\resizefont\tenbf \tenbf Title text}
%
% The \resizeall macro resizes the \tentt, \tenrm, \tenit, \tenbf, \tenbi
% font selectors by currently defined \sizespec.
% The \regfont adds a new `registered' font-selector to the \resizeall macro
% The font-loading macros can register their fonts by \regfont.
\def\sizespec{} % by default: fonts are loaded in their implicit sizes
\def\resizefont #1{\expandafter
\font\expandafter#1\expandafter\resizefontskipat\fontname#1 \relax}
\def\resizefontskipat#1 #2\relax{#1 \sizespec\relax}
\font\tenbi=csbxti10 % it may be usable to have
% the quartet \rm \it \bf \bi preloaded
\def\bi{\tenbi} % math \fam\bifam is not preloaded now
\def\regfont#1{\expandafter\def\expandafter\resizeall\expandafter{%
\resizeall \resizefont#1}}
\def\resizeall{}
\regfont\tenrm \regfont\tenit \regfont\tenbf \regfont\tenbi
\regfont\tentt
% You can use: \letfont \titlefont = \tenbf at15pt
\def\letfont #1{%
\def\tmp##1 {\let\tmp\sizespec \def\sizespec{##1}\resizefont#1\let\sizespec\tmp}%
\afterassignment\tmp \let#1}
\endinput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The notice about resizing the current font.
You can't use \expandafer \resizefont \the\font because \the\font expands to
the token with internal meaning: ``current font'' and with external
representation \fontselector where \fontselector is the control sequence
used by primitive \font as a parameter. The internal meaning has a
precedence and the token \the\font is inaccesible. You can make an accesible
control sequence by re-packing it by \csname...\endcsname. Thus the macro
\currsize{<size>} which sets the typesetting of the current font to the
desired <size> may be:
\def\currsize#1{%
{\escapechar=-1\xdef\tmp{\csname\expandafter\string\the\font\endcsname}}%
\def\sizespec{at#1}\expandafter\resizefont\tmp \tmp}
or:
\def\currsize#1{%
\expandafter\let \expandafter\tmp \the\font
\def\sizespec{at#1}\resizefont\tmp \tmp}
% end of csfontsm.tex
|