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
|
% The file cs-heros.tex (C) Petr Olsak, 2012, 2016
% Use "\input cs-heros" to set the TG Heros font family in text mode
% See end of this file for more information
\ifx\ffdecl\undefined \input ff-mac \fi
\ffdecl [TG Heros] {\rm \bf \it \bi} {\caps \cond} {} {TX} {8z 8t U}
\ffvars {r}{b}{ri}{bi}
\def\caps{\ffsetV{caps}{-sc}\ffsetX} \def\nocaps{\ffsetV{caps}{}\ffsetX}
\def\cond{\ffsetV{cond}{c}\ffsetX} \def\nocond{\ffsetV{cond}{}\ffsetX}
\def\capsV{}
\def\condV{}
\ismacro\fotenc{8t}\ifttrue
\font\tenrm = ec-qhvr \sizespec
\font\tenbf = ec-qhvb \sizespec
\font\tenit = ec-qhvri \sizespec
\font\tenbi = ec-qhvbi \sizespec
\def\ffnamegen{ec-qhv\condV\ffvarV\capsV}
\fi
\ismacro\fotenc{8z}\iftrue
\font\tenrm = cs-qhvr \sizespec
\font\tenbf = cs-qhvb \sizespec
\font\tenit = cs-qhvri \sizespec
\font\tenbi = cs-qhvbi \sizespec
\def\ffnamegen{cs-qhv\condV\ffvarV\capsV}
\input chars-8z
\fi
\ismacro\fotenc{U}\iftrue
\font\tenrm = "[texgyreheros-regular]:\fontfeatures" \sizespec
\font\tenbf = "[texgyreheros-bold]:\fontfeatures" \sizespec
\font\tenit = "[texgyreheros-italic]:\fontfeatures" \sizespec
\font\tenbi = "[texgyreheros-bolditalic]:\fontfeatures" \sizespec
\def\ffnamegen{"[texgyreheros\condV-\ffvarV]:\capsV\fontfeatures"}
\ffvars {regular} {bold} {italic} {bolditalic}
\def\caps{\ffsetV{caps}{+smcp;}\ffsetX}
\def\cond{\ffsetV{cond}{cn}\ffsetX}
\fi
\tenrm % don't remember to initialize the family with normal font.
\def\narrow{\cond\fam}
\ifx\loadmathfonts\relax \endinput \fi
\ifx\mathpreloaded X\else \input tx-math \fi
\endinput
--------------------------------------------------------------
For users
=========
There are four basic font variant selectors: \rm, \bf, \it, \bi. They are ready
to print text in Heros (like Helvetica) variants after \input cs-heros.
You can use "modifiers" of these basic variants: \cond, \caps. They can be
independently combined but must be immediately followed by \rm, \bf, \it,
\bi, \one or \fam. If basic variant selector is used then given variant
combined by modifiers is selected. If selectors are followed by \one, the
currently selected variant is combined by modifier(s). If \fam is used then it
works like \one but all four variant selectors are modified by the
modifier(s).
Examples:
{\cond\rm text} ... Normal condensed.
{\caps\cond\it text} ... Caps & small-caps plus condensed italics.
{\cond\one text} ... Condensed modification of active variant.
{\caps\fam text \bf text} ... Caps & small-caps, now all basic selectors
\rm, \bf, \it, \bi keeps this modification.
All font selectors and their modifiers do setting data locally inside TeX
group.
The TX math fonts are loaded together with this text family. If you need not
load special fonts then you can set \let\loadmathfonts=\relax before
\input cs-heros. Of course, you can input any different math font collection,
for example \input ntx-math.
You can combine fonts from more families. Load the main family last. You can
use \ffletfont\newselector = {mod+var}{size} for keeping variants from
previous loading. Example:
\input cs-heros
\ffletfont \titlefont = {\cond\bf}{at14pt} % Heros condensed for titles
\input cs-termes % Termes at 10 pt for normal text
If you are using XeTeX or LuaTeX then the U (unicode) encoding is used and
OTF fonts are loaded. You can use \useff{text} in such case. This works like
another modifier and does modification of font-features. Use
otfinfo -f file.otf to inspect the font features of used font. Example:
\useff{+onum;+salt}\bf ... use Bold variant with oldstyle digits and
stylistic alternatives
\useff{+onum;+salt}\fam ... use given features for whole family.
See the document kpfonts-plain.pdf for more information.
For font-file developers
========================
Use \ifx\ffdecl\undefined \input ff-mac \fi first. The ff-mac.tex macro file
provides:
\sizespec .. is empty or it keeps the size specification of the font.
\ffdecl .... prints font message and checks the font encoding.
\ffvars .... declares four basic variants (values for \ffvarV)
\setfmV, \setfm ... macros used in font modifiers
\ismacro ... test if the macro is defined as given.
\fotenc .... encoding of text fonts.
\fontfeatures ... default (or user defined) fontfeatures if Unicode
fonts are used.
\ffalias ... register alias of a font name.
\regsizes .. register optical sizes.
\tryprotected ... makes the macro defined as "robust".
You must declare four basic variants \tenrm, \tembf, \tenit and \tenbi
using \font primitive in your font-file. These four basic variants work
immediately after font-file is read because \rm, \bf, \it and \bi expands
to \tenrm, \tenbf, \tenit and \tenbi.
You can declare more cases for various font encondings. User can define font
encoding by \def\fotenc{something}. Note, that ff-mac.tex keeps the \fotenc
macro unchanged, but if it is not defined then it does:
- \def\fotenc{8z} if CSplain is used without \input t1code nor \input ucode
- \def\fotenc{8t} if \input t1code or pdfTeX without CSplain is used
- \def\fotenc{U} if \input ucode or XeTeX or LuaTeX is used
8z means IL2 encoding (default in CSplain), 8t means T1 encoding and U means
Unicode.
If the family does not provide all four basic variants then keep missing
variants undeclared and use parameter {!} in appropriate \ffvars parameter.
Last two lines in the code above loads the default math fonts. The "X"
letter (as \mathpreloaded) is reserved for TX fonts collection. The "A"
letter is reserved for AMS math fonts.
\ffdecl [Family Name] {basic selectors} {modifiers} {comment} {math} {enc}
-------------------------------------------------------------------------
This macro stops reading the file (with warning) if the \fotenc is not
included in the provided encodings given in the last parameter. Else it
prints the message about font family, its selectors, modifiers and appends
the comment.
\ffvars {normal} {bold} {italic} {bolditalic}
---------------------------------------------
This macro gives the values to the \ffvarV macro dependent on what basic
variant is needed. The \ffvarV macro is used in \ffnamegen. See below.
If you need to implement font modifier (say \modfoo), then define
\def\modfoo{\ffsetV{foo}{text}\ffsetX}
The macro \ffsetV{foo}{text} define \fooV macro as text. So, you can use
\fooV in \ffnamegen.
Next, define default value for \fooV by \def\fooV{}.
Finally, define the generic font name using \ffvarV and \fooV in it.
These names are expanded to basic variant name given by \ffvars and the
actual value of \fooV given by \ffsetV. For example, if the metric names of
the font family are
baaRMwhat.tfm ... normal
baaBFwhat.tfm ... bold
baaRMwhatFF.tfm ... normal modified by FF
baaBFwhatFF.tfm ... bold modified by FF
then declare \ffvars {RM} {BF} {!} {!} and define
\def\modfoo{\ffsetV{foo}{FF}\ffsetX} \def\nomodfoo{\ffsetV{foo}{}\ffsetX}
and finaly define \ffnamegen as:
\def\ffnamegen{baa\ffvarV what\fooV}
The font modifiers are based on the fact that font names of fonts includes
these modifiers flags at given place in the name and they are independent
one to another.
All (modified) variants can be used in all various sizes by standard
resizing tools given in CSplain or OPmac.
\ffalias {virtual-name} {real-name}
-----------------------------------
The \ffalias macro provides substitution of virtual-name by real-name.
The virtual-name is a result of the expansion of \ffnamegen and real-name is
definitely used.
Example. Suppose that baaBFwhatFF.tfm is not present and when the \modfoo\bf
is used then error during loading baaBFwhatFF.tfm occurs. To avoid this, you
can declare:
\ffalias {baaBFwhatFF} {baaRMwhatFF}
Now, the baaRMwhatFF.tfm is used instead baaBFwhatFF.tfm.
\regsizes {modifiers} {data}
----------------------------
You can use \ffoptV in the \ffnamegen. It includes the optical size value of
the font. For example, Antykwa Poltawkiego includes:
ec-antpr6.tfm ec-antpr8.tfm ec-antpr10.tfm ec-antpr12.tfm ex-antpr17.tfm
and analogical names are used for all basic variants {r}{b}{ri}{bi} and for
\caps variants. You can see to the cs-polta.tex file that the \ffnamegen is
defined by \def\ffnamegen{ec-antp\ffvarV\ffoptV\capsV}.
If the \ffoptV is used in \ffnamegen then you must register optical
sizes for all variants and modified variants into internal data structure.
The \regsizes macro does this. Code from cs-polta.tex looks like this:
\regsizes {} {0 =6 7 =8 9 =10 11 =12 14 =17}
\regsizes {\wlight} {0 =6 7 =8 9 =10 11 =12 14 =17}
\regsizes {\caps} {0 =6 7 =8 9 =10 11 =12 14 =17}
\regsizes {\wlight\caps} {0 =6 7 =8 9 =10 11 =12 14 =17}
There are two independent modifiers \wlight and \caps, so there are four
possible modifications. These modifications are included in the first
parameter. The second "data" parameter includes couples
"bondary =optsize boundary =optsize" etc. If the desired size is 11.5pt (for
example) then it fits to the bounaries [11pt, 14pt), thus the value 12 is
used in the \ffoptV macro.
The \regsizes is implemented by \regtfm macro, see the ams-math.tex file.
You cannot combine \ffalias together with \regsizes.
\tryprotected \def\foo
----------------------
The macro \foo is defined as \protected\def it the \protected
primitive is available. Else it is defined normally but if \addprotect from
OPmac is available then \addprotect\foo is used. Only if \protected
rimitive isn't available and \addprotect from Opmac isn't available, the
\foo macro is leaved unprotected which brings potential problem when such
macro is used by user in a \write parameter (typically section names when
table of contents is generated).
Note that the macros \rm, \bf, \it and \bi need not to be
\protected (and they are not protected). If user put these macro to a
parameter of "\write" then nothig critical happens. They are expanded but
only first level of expansion is done, because they includes only
unexpandable primitive \fam, a constant and a font selector declared by
\font.
Do not set font modifiers as protected!. The last macro used in each font
modifer (\ffsetX) must be expanded during \wite exapnsion. It changes to
the internal macro \ffsetY depending on the control sequence wich is
followed. The \ffsetV and \ffvars macros are protected in ff-mac.tex. For
example, suppose that yu define a modifier:
\def\modfoo{\ffvars{A}{B}{C}{D}\ffsetV{foo}{text}\ffsetX}
and a user writes \modfoo\it in a \write parameter. The the macro is
expanded to
\ffvars{A}{B}{C}{D}\ffsetV{foo}\ffsetY2
in \write file. After the data are read from file again, they do exactly
what we need. But if the \modfoo is protected, then \modfoo\it is expanded
into \write file like \modfoo\fam\itfam\tenit and this is bad.
|