Debian Codegraph @

texmf-dist/tex/optex/base/fonts-select.opm

raw
1 %% This is part of the OpTeX project, see http://petr.olsak.net/optex
2
3 \_codedecl \fontfam {Fonts selection system <2025-06-29>} % preloaded in format
4
5 \_doc -----------------------------
6 The main principle of the Font Selection System is: run one or more
7 modifiers followed by \^`\fontsel`. Modifiers save data and \^`\fontsel`
8 selects the font considering saved data. Each basic variant selector
9 \`\rm`, \`\bf`, \`\it`, \`\bi`, and \`\tt` runs internal variant modifier
10 \`\_fmodrm`, \`\_fmodbf`, \`\_fmodit`, \`\_fmodbi` and \`\_fmodtt`.
11 These modifiers save their data to the \`\_famv` macro which is
12 `rm` or `bf` or `it` or `bi` or `tt`. The \`\currvar` selector
13 is \^`\fontsel` by default, but variant selectors declared by
14 \^`\famvardef` change it.
15 \_cod -----------------------------
16
17 \_def\_famv{rm} % default value
18 \_protected\_def \_fmodrm {\_def\_famv{rm}}
19 \_protected\_def \_fmodbf {\_def\_famv{bf}}
20 \_protected\_def \_fmodit {\_def\_famv{it}}
21 \_protected\_def \_fmodbi {\_def\_famv{bi}}
22 \_protected\_def \_fmodtt {\_def\_famv{tt}}
23
24 \_protected\_def \_rm {\_fmodrm \_fontsel \_marm}
25 \_protected\_def \_bf {\_fmodbf \_fontsel \_mabf}
26 \_protected\_def \_it {\_fmodit \_fontsel \_mait}
27 \_protected\_def \_bi {\_fmodbi \_fontsel \_mabi}
28 \_protected\_def \_tt {\_fmodtt \_fontsel \_matt}
29 \_protected\_def \_currvar {\_fontsel} \_protected\_def \currvar{\_currvar}
30 \_public \rm \bf \it \bi \tt ;
31
32 \_doc -----------------------------
33 The \`\fontsel` creates the <font switch> in the format `\_ten<famv>`
34 and loads the font associated to the <font switch>.
35 The loading is done by:
36 \begitems \style a
37 * `\letfont <font switch> = \savedswitch \_sizespec`
38 * `\font <font switch> = \fontnamegen \_sizespec`
39 \enditems
40 The a) variant is used when \~`\_fontnamegen` isn't defined, i.e.\
41 \^`\fontfam` wasn't used: only basic variant and \^`\_sizespec` is taken
42 into account. The b) variant is processed when \^`\fontfam` was used:
43 all data saved by all font modifiers are used during expansion of \^`\_fontnamegen`.\nl
44 After the font is loaded, final job is done by \`\_fontselA``<font-switch>`.
45 \_cod -----------------------------
46
47 \_protected\_def \_fontsel {%
48 \_ifx\_fontnamegen\_undefined % \fontfam was not used
49 \_ea\_let \_ea\_tmpf \_csname _ten\_famv\_endcsname
50 \_ea\_fontlet \_csname _ten\_xfamv\_endcsname \_tmpf \_sizespec
51 \_else % \fontfam is used
52 \_ea\_font \_csname _ten\_xfamv\_endcsname {\_fontnamegen}\_sizespec
53 \_fi \_relax
54 \_ea \_fontselA \_csname _ten\_xfamv\_endcsname
55 }
56 \_def\_fontselA #1{%
57 \_protected\_def \_currvar {\_fontsel}% default value of \_currvar
58 \_logfont #1% font selecting should be logged.
59 \_setwsp #1% wordspace setting
60 \_fontloaded #1% initial settings if font is loaded firstly
61 #1% select the font
62 }
63 \_def \_logfont #1{}
64 \_def \_xfamv {\_famv}
65
66 \_public \fontsel ;
67
68 \_doc -----------------------------
69 If a font is loaded by macros \^`\fontsel` or \^`\resizethefont` then the
70 \`\_fontloaded``<font switch>` is called immediately after it. If the font
71 is loaded first then its `\skewchar` is equal to $-1$. We run
72 \`\_newfontloaded``<font switch>` and set `\skewchar=-2` in this case.
73 A user can define a `\_newfontloaded` macro. We are sure that
74 `\_newfontloaded` macro is called only once for each instance of the font
75 given by its name, OTF features and size specification. The `\skewchar` value is
76 globally saved to the font (like `\fontdimen`). If it is used in math
77 typesetting then it is set to a positive value.\nl
78 The `\_newfontloaded` should be defined for micro-typographic configuration of
79 fonts, for example. The `mte.opm` package uses it. See also
80 \ulink[http://petr.olsak.net/optex/optex-tricks.html\#fontexpand]{\OpTeX/ trick 0058}.
81 \_cod -----------------------------
82
83 \_def\_fontloaded #1{\_ifnum\_skewchar#1=-1 \_skewchar#1=-2 \_newfontloaded#1\_fi}
84 \_def\_newfontloaded #1{}
85
86 \_doc -----------------------------
87 \`\_ttunifont` is default font for \^`\tt` variant when \^`\initunifonts` is declared.
88 User can re-define it or use \^`\famvardef``\tt`.
89 The \`\_unifmodtt` macro is used instead \^`\_fmodtt` after
90 \^`\initunifonts`. It ignores the loading part of the following \^`\fontsel`
91 and do loading itself.
92 \_cod -----------------------------
93
94 \_def\_ttunifont{[lmmono10-regular]:\_fontfeatures-tlig;}
95 \_def\_unifmodtt\_fontsel{% ignore following \_fontsel
96 \_ea\_font \_csname _ten\_ttfamv\_endcsname {\_ttunifont}\_sizespec \_relax
97 \_ea\_fontselA \_csname _ten\_ttfamv\_endcsname
98 \_def \_currvar{\_tt}%
99 }
100 \_def\_ttfamv{tt}
101
102 \_doc ----------------------------
103 A large part of the Font Selection System was re-implemented in Feb. 2022.
104 We want to keep backward compatibility:
105 \_cod ----------------------------
106
107 \_def \_tryloadrm\_tenrm {\_fmodrm \_fontsel}
108 \_def \_tryloadbf\_tenbf {\_fmodbf \_fontsel}
109 \_def \_tryloadit\_tenit {\_fmodit \_fontsel}
110 \_def \_tryloadbi\_tenbi {\_fmodbi \_fontsel}
111 \_def \_tryloadtt\_tentt {\_fmodtt \_fontsel}
112 \_def \_reloading {}
113
114 \_doc -----------------------------
115 The \`\_famdecl` `[<Family Name>] \<Famselector> {<comment>} {<modifiers>} {<variants>} {<math>}`\nl
116 `{<font for testing>} {\def`\^`\_fontnamegen``{<data>}}` runs \^`\initunifonts`, then
117 checks if `\<Famselector>` is defined. If it is true, then closes the file by
118 `\endinput`. Else it defines `\<Famselector>` and saves it to the
119 internal `\_f:<currfamily>:main.fam` command.
120 The macro \`\_initfontfamily` needs it. The \`\_currfamily` is set
121 to the `<Famselector>` because the following \^`\moddef` commands need to
122 be in the right font family context. The `\_currfamily` is set to the
123 `<Famselector>` by the `\<Famselector>` too, because `\<Famselector>`
124 must set the right font family context. The font family context is given by the current
125 `\_currfamily` value and by the current meaning of the \^`\_fontnamegen` macro.
126 The \`\_mathfaminfo` is saved for usage in the catalog.
127 \_cod -----------------------------
128
129 \_def\_famdecl [#1]#2#3#4#5#6#7#8{%
130 \_initunifonts \_unichars \_uniaccents
131 \_unless\_ifcsname _f:\_csstring#2:main.fam\_endcsname
132 \_isfont{#7}\_iffalse
133 \_opwarning{Family [#1] skipped, font "#7" not found}\_endinput
134 \_ifcsname _fams:\_famfile\_endcsname \_famsubstitute \_fi
135 \_else
136 \_edef\_currfamily {\_csstring #2}\_def\_mathfaminfo{#6}%
137 \_wterm {FONT: [#1] -- \_string#2 \_detokenize{(#3)^^J mods:{#4} vars:{#5} math:{#6}}}%
138 \_unless \_ifx #2\_undefined
139 \_opwarning{\_string#2 is redefined by \_string\_famdecl\_space[#1]}\_fi
140 \_protected\_edef#2{\_def\_noexpand\_currfamily{\_csstring #2}\_unexpanded{#8\_resetfam}}%
141 \_ea \_let \_csname _f:\_currfamily:main.fam\_endcsname =#2%
142 \_fi
143 \_else \_csname _f:\_csstring#2:main.fam\_endcsname \_rm \_endinput \_empty\_fi
144 }
145 \_def\_initfontfamily{%
146 \_csname _f:\_currfamily:main.fam\_endcsname \_rm
147 }
148
149 \_doc -----------------------------
150 \`\_fvars` `<rm-template> <bf-template> <it-template> <bi-template>`
151 saves data for usage by the `\_currV` macro. If a template is only dot
152 then previous template is used (it can be used if the font family doesn't
153 dispose with all standard variants).
154 \nl
155 \`\_currV` expands to a template declared by `\_fvars` depending on the
156 `<variant name>`. Usable only of standard four variants. Next variants
157 can be declared by the \^`\famvardef` macro.
158 \nl
159 \`\_fsetV` `<key>=<value>,...,<key>=<value>` expands to
160 `\def\_<key>V{<value>}` in the loop.
161 \nl
162 \`\_onlyif` `<key>=<value-a>,<value-b>...,<value-z>: {<what>}`
163 expands <what> only if the `\_<key>V` is defined as `<value-a>` or
164 `<value-b>` or ... or `<value-z>`.
165 \nl
166 \`\_prepcommalist` `ab,{},cd,\_fin,` expands to `ab,,cd,` (auxiliary macro
167 used in `\_onlyif`).\nl
168 \`\_ffonum` is a shortcut for oldstyle digits font features used in
169 font family files. You can do `\let\_ffonum=\ignoreit` if you don't want
170 to set old digits together with `\caps`.
171 \_cod -----------------------------
172
173 \_def\_fvars #1 #2 #3 #4 {%
174 \_sdef{_fvar:rm}{#1}%
175 \_sdef{_fvar:bf}{#2}%
176 \_ifx.#2\_slet{_fvar:bf}{_fvar:rm}\_fi
177 \_sdef{_fvar:it}{#3}%
178 \_ifx.#3\_slet{_fvar:it}{_fvar:rm}\_fi
179 \_sdef{_fvar:bi}{#4}%
180 \_ifx.#4\_slet{_fvar:bi}{_fvar:it}\_fi
181 }
182 \_def\_currV{\_trycs{_fvar:\_famv}{rm}}
183 \_def\_V{ }
184 \_def \_fsetV #1 {\_fsetVa #1,=,}
185 \_def \_fsetVa #1=#2,{\_isempty{#1}\_iffalse
186 \_ifx,#1\_else\_sdef{_#1V}{#2}\_ea\_ea\_ea\_fsetVa\_fi\_fi
187 }
188 \_def \_onlyif #1=#2:#3{%
189 \_expanded{\_noexpand\_isinlist{,\_prepcommalist #2,\_fin,}{,\_cs{_#1V},}}%
190 \_iftrue #3\_fi
191 }
192 \_def\_prepcommalist#1,{\_ifx\_fin#1\_empty\_else #1,\_ea\_prepcommalist\_fi}
193 \_def\_ffonum {+onum;+pnum}
194
195 \_doc -----------------------------
196 The \`\moddef` `\<modifier> {<data>}` simply speaking does
197 `\def\<modifier>{<data>}`, but we need to respect
198 the family context. In fact, `\protected\def\_f:<current family>:<modifier>{<data>}` is
199 performed and the `\<modifier>` is defined as
200 \`\_famdepend``\<modifier>{_f:\_currfamily:<modifier>}`. It expands to
201 `\_f:\_currfamily:<modifier>` value if it is defined or it prints
202 the warning. When the `\_currfamily` value is
203 changed then we can declare the same `\<modifier>` with a different meaning.
204
205 \`\_setnewmeaning` `<cs-name>=\_tmpa <by-what>` does exactly `\_let <csname>=\_tmpa`
206 but warning is printed if <cs-name> is defined already and it is not a variant
207 selector or font modifier.
208
209 \`\_addtomodlist` `<font modifier>` adds given modifier to \`\_modlist`
210 macro. This list is used after \^`\resetmod` when a new family is selected by
211 a family selector, see \`\_resetfam` macro.
212 This allows reinitializing the same current modifiers in the font context
213 after the family is changed.
214 \_cod -----------------------------
215
216 \_def \_moddef #1#2{%
217 \_edef\_tmp{\_csstring#1}%
218 \_sdef{_f:\_currfamily:\_tmp}{\_addtomodlist#1#2}%
219 \_protected \_edef \_tmpa{\_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_tmp}}%
220 \_setnewmeaning #1=\_tmpa \moddef
221 }
222 \_protected \_def\_resetmod {\_cs{_f:\_currfamily:resetmod}} % private variant of \resetmod
223 \_def \_resetfam{%
224 \_def\_addtomodlist##1{}\_resetmod
225 \_edef \_modlist{\_ea}\_modlist
226 \_let\_addtomodlist=\_addtomodlistb
227 \_ifcsname _f:\_currfamily:\_ea\_csstring \_currvar \_endcsname
228 \_else \_ea\_ifx\_currvar\_tt \_else \_def\_currvar{\_fontsel}\_fi
229 \_fi % corrected \_currvar in the new family
230 }
231 \_def \_currfamily{} % default current family is empty
232 \_def \_modlist{} % list of currently used modifiers
233
234 \_def \_addtomodlist#1{\_addto\_modlist#1}
235 \_let \_addtomodlistb=\_addtomodlist
236
237 \_def\_famdepend#1#2{\_ifcsname#2\_endcsname \_csname#2\_ea\_endcsname \_else
238 \_ifx\_addtomodlist\_addtomodlistb
239 \_opwarning{\_string#1 is undeclared in family "\_currfamily", ignored}\_fi\_fi
240 }
241 \_def\_setnewmeaning #1=\_tmpa#2{%
242 \_ifx #1\_undefined \_else \_ifx #1\_tmpa \_else
243 \_opwarning{\_string#1 is redefined by \_string#2}%
244 \_fi\_fi
245 \_let#1=\_tmpa
246 }
247 \_public \moddef ;
248
249 \_doc -----------------------------
250 \`\fontdef` `<font-switch> {<data>}` does:
251 \begtt \catcode`\<=13
252 \begingroup <data> \ea\endgroup \ea\let \ea<font-switch> \the\font
253 \endtt
254 It means that font modifiers used in <data> are applied in the group and the
255 resulting selected font (current at the end of the group) is set to the
256 <font-switch>.
257 We want to declare <font-switch> in its real name directly by `\font` primitive in
258 order to save this name for reporting later (in overfull messages, for
259 example). This is the reason why \`\_xfamv` and \`\_ttfamv` are re-defined locally here.
260 They have precedence when \^`\fontsel` constructs the <font switch> name.
261 \_cod -----------------------------
262
263 \_protected\_def \_fontdef #1#2{\_begingroup
264 \_edef\_xfamv{\_csstring#1}\_let\_ttfamv\_xfamv #2%
265 \_ea\_endgroup\_ea \_let\_ea #1\_the\_font
266 }
267 \_public \fontdef ;
268
269 \_doc -----------------------------
270 The \`\famvardef` `\xxx {<data>}` does, roughly speaking:
271 \begtt \catcode`\<=13
272 \def \xxx {{<data>\ea}\the\font \def\_currvar{\xxx}}
273 \endtt
274 but the macro `\xxx` is declared as family-dependent.
275 It is analogically as in `\moddef`.
276 The `\xxx` is defined as `\_famdepend\xxx{_f:\_currfamily:xxx}`
277 and `\_f:<currfam>:xxx` is defined as mentioned.\nl
278 `\famvardef\tt` behaves somewhat differently: it defines internal version
279 `\_tt` (it is used in \^`\_ttfont` and \^`\_urlfont`) and set `\tt` to
280 the same meaning.
281 \_cod -----------------------------
282
283 \_protected\_def \_famvardef #1#2{%
284 \_sdef{_f:\_currfamily:\_csstring#1}%
285 {{\_edef\_xfamv{\_csstring#1}\_let\_ttfamv\_xfamv #2\_ea}\_the\_font \_def\_currvar{#1}}%
286 \_protected\_edef\_tmpa {%
287 \_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_csstring#1}}%
288 \_ifx #1\tt
289 \_protected\_def\_tt{{\_def\_xfamv{tt}#2\_ea}\_the\_font \_def\_currvar{\_tt}\_matt}%
290 \_let\tt=\_tt
291 \_else \_setnewmeaning #1=\_tmpa \famvardef
292 \_fi
293 }
294 \_public \famvardef ;
295
296 \_doc -----------------------------
297 The \`\fontfam` `[<Font Family>]` does:
298 \begitems
299 * Convert its parameter to lower case and without spaces, e.g.\ `<fontfamily>`.
300 * If the file `f-<fontfamily>.opm` exists read it and finish.
301 * Try to load user defined `fams-local.opm`.
302 * If the `<fontfamily>` is declared in `fams-local.opm` or `fams-ini.opm`
303 read relevant file and finish.
304 * Print the list of declared families.
305 \enditems
306 The `fams-local.opm` is read by the \`\_tryloadfamslocal` macro. It sets
307 itself to `\_relax` because we need not load this file twice.
308 The \`\_listfamnames` macro prints registered font families to the
309 terminal and to the log file.
310 \_cod -----------------------------
311
312 \_protected\_def \_fontfam [#1]{%
313 \_lowercase{\_edef\_famname{\_ea\_removespaces \_expanded{#1} {} }}%
314 \_isfile {f-\_famname.opm}\_iftrue \_edef\_famfile{f-\_famname}\_opinput {f-\_famname.opm}%
315 \_else
316 \_tryloadfamslocal
317 \_edef\_famfile{\_trycs{_famf:\_famname}{}}%
318 \_ifx\_famfile\_empty
319 \_ifcsname _fams:f-\_famname \_endcsname \_edef\_famfile{f-\_famname}\_famsubstitute
320 \_else \_listfamnames
321 \_fi
322 \_else \_opinput {\_famfile.opm}%
323 \_fi\_empty\_fi
324 }
325 \_def\_tryloadfamslocal{%
326 \_isfile {fams-local.opm}\_iftrue
327 \_opinput {fams-local.opm}\_famfrom={}\_famsrc={}%
328 \_fi
329 \_let \_tryloadfamslocal=\_relax % need not to load fams-local.opm twice
330 }
331 \_def\_listfamnames {%
332 \_wterm{===== List of font families ======}
333 \_begingroup
334 \_let\_famtext=\_wterm
335 \_def\_faminfo [##1]##2##3##4{%
336 \_wterm{ \_space\_noexpand\fontfam [##1] -- ##2}%
337 \_let\_famalias=\_famaliasA}%
338 \_opinput {fams-ini.opm}%
339 \_isfile {fams-local.opm}\_iftrue \_opinput {fams-local.opm}\_fi
340 \_message{^^J}%
341 \_endgroup
342 }
343 \_def\_famaliasA{\_message{ \_space\_space\_space\_space -- alias:}
344 \_def\_famalias[##1]{\_message{[##1]}}\_famalias
345 }
346 \_public \fontfam ;
347
348 \_doc -----------------------------
349 \`\fontfamsub` `[<Family>][<byFamily>]` declares automatic substitution of
350 <Family> by <byFamily> which is done when <Family> is not installed. I.e.
351 if there is no `f-<family>.opm` file or there is no regular font of the
352 family installed.
353 \`\_famsubstitute` is internal macro used in \^`\fontfam` and \^`\_famdecl` macros.
354 It consumes the rest of the macro, runs \^`\nospacefuturelet` in order to
355 do `\endinput` to the current `f-file` and runs \^`\fontfam` again.
356 The table of such substutitions are saved in the macros `\_fams:<family-file>`.
357 \_cod -----------------------------
358
359 \_def \_fontfamsub [#1]#2[#3]{\_tryloadfamslocal
360 \_lowercase{\_edef\_tmp{\_removespaces #1 {} }}%
361 \_sxdef{_fams:\_trycs{_famf:\_tmp}{f-\_tmp}}{#3}%
362 }
363 \_def\_famsubstitute #1\_empty\_fi{\_fi\_fi\_fi
364 \_wterm {FONT-SUB: \_famfile\_space -> [\_cs{_fams:\_famfile}]}%
365 \_nospacefuturelet\_tmp\_famsubstituteA % we want to \endinput current f-file
366 }
367 \_def\_famsubstituteA{\_fontfam[\_cs{_fams:\_famfile}]}
368
369 \_public \fontfamsub ;
370
371 \_doc -----------------------------
372 When the `fams-ini.opm` or `fams-local.opm` files are read then we need
373 to save only a mapping from family names or alias names to the font family file
374 names. All other information is ignored in this case. But if these files
375 are read by the `\_listfamnames` macro or when printing a catalog then more
376 information is used and printed.\nl
377 \`\_famtext` does nothing or prints the text on the terminal.
378 \nl
379 \`\_faminfo` `[<Family Name>] {<comments>} {<file-name>} {<mod-plus-vars>}`
380 does\nl `\_def \_famf:<familyname> {<file-name>}` (only if <file-name> differs
381 from `f-<familyname>`) or prints information on the terminal. The
382 <mod-plus-vars> data are used when printing the font catalog.
383 \nl
384 \`\_famalias` `[<Family Alias>]` does `\def \_famf:<familyalias> {<file-name>}`
385 where `<file-name>` is stored from the previous `\_faminfo` command. Or
386 prints information on the terminal.
387 \nl
388 \`\_famfrom` declares type foundry or owner or designer of the font family.
389 It can be used in `fams-ini.opm` or `fams-local.opm` and it is printed
390 in the font catalog.
391 \nl
392 \`\_famsrc` declares the source, where is the font family from (used in `fams-ini.opm`
393 and if the font isn't found when the fonts catalog is printed).
394 \_cod -----------------------------
395
396 \_def\_famtext #1{}
397 \_def\_faminfo [#1]#2#3#4{%
398 \_lowercase{\_edef\_tmp{\_ea\_removespaces #1 {} }}%
399 \_edef\_tmpa{f-\_tmp}\_def\_famfile{#3}%
400 \_unless\_ifx\_tmpa\_famfile \_sdef{_famf:\_tmp}{#3}\_fi
401 }
402 \_def\_famalias [#1]{%
403 \_lowercase{\_edef\_tmpa{\_ea\_removespaces #1 {} }}%
404 \_sdef{_famf:\_tmpa\_ea}\_ea{\_famfile}%
405 }
406 \_newtoks\_famfrom \_newtoks\_famsrc
407 \_input fams-ini.opm
408 \_let\_famfile=\_undefined
409 \_famfrom={} \_famsrc={}
410
411 \_doc -----------------------------
412 When the \^`\fontfam``[catalog]` is used then the file
413 `fonts-catalog.opm` is read. The macro \^`\_faminfo` is redefined here
414 in order to print catalog samples of all declared modifiers/variant
415 pairs. The user can declare different samples and different behavior of
416 the catalog, see the end of catalog listing for more information.
417 The default parameters
418 \`\catalogsample`, \`\catalogmathsample`, \`\catalogonly`,
419 \`\catalogexclude` and \`\catalognextfam` of the catalog are declared here.
420 \_cod -----------------------------
421
422 \_newtoks \_catalogsample
423 \_newtoks \_catalogmathsample
424 \_newtoks \_catalogonly
425 \_newtoks \_catalogexclude
426 \_newtoks \_catalognextfam
427 \_catalogsample={ABCDabcd Qsty fi fl áéíóúüů řžč ÁÉÍÓÚ ŘŽČ 0123456789}
428 \_catalognextfam={\_bigskip}
429
430 \_public \catalogonly \catalogexclude \catalogsample \catalogmathsample \catalognextfam ;
431
432 \_doc -----------------------------
433 The font features are managed in the \`\_fontfeatures` macro.
434 It expands to
435 \begitems
436 * \`\_defaultfontfeatures` -- used for each font,
437 * \`\_ffadded` -- features added by \^`\setff`,
438 * \`\_ffcolor` -- features added by \^`\setfontcolor` (this is obsolette)
439 * \`\_ffletterspace` -- features added by \^`\setletterspace`,
440 * \`\_ffwordspace` -- features added by \^`\setwordspace`.
441 \enditems
442 The macros \^`\_ffadded`, \^`\_ffcolor`, \^`\_ffletterspace`,
443 \^`\_ffwordspace` are empty by default.
444 \_cod -----------------------------
445
446 \_def \_fontfeatures{\_defaultfontfeatures\_ffadded\_ffcolor\_ffletterspace\_ffwordspace}
447 \_def \_defaultfontfeatures {+tlig;}
448 \_def \_ffadded{}
449 \_def \_ffcolor{}
450 \_def \_ffletterspace{}
451 \_def \_ffwordspace{}
452
453 \_doc -----------------------------
454 The \`\setff` `{<features>}` adds next font features to \^`\_ffadded`.
455 Usage \^`\setff{}` resets empty set of all \^`\_ffadded` features.
456 \_cod -----------------------------
457
458 \_def \_setff #1{%
459 \_ifx^#1^\_def\_ffadded{}\_else \_edef\_ffadded{\_ffadded #1;}\_fi
460 }
461 \_public \setff ;
462
463 \_doc -----------------------------
464 \`\setletterspace` is based on the
465 special font features provided by `luaotfload` package.\nl
466 The \`\setwordspace` recalculates the `\fontdimen2,3,4`
467 of the font using the \`\setwsp` macro which is used by the
468 \^`\_fontselA` macro. It activates a dummy font feature `+Ws` too in
469 order the font is reloded by the `\font` primitive (with independent
470 `\fontdimen` registers).
471 If the \^`\setwordspace` is used again to the same font then we need to
472 reset `\fondimen` registers first. It is done by `\_sws:<fontname>`
473 macro which keeps the original values of the `\fontdimen`s.\nl
474 \`\setfontcolor` is kept here only for backward compatibility but not
475 recommended. Use real color switches and the \^`\transparency` instead.
476 \_cod -----------------------------
477
478 \_def \_setfontcolor #1{%
479 \_edef\_tmp{\_calculatefontcolor{#1}}%
480 \_ifx\_tmp\_empty \_def\_ffcolor{}\_else \_edef\_ffcolor{color=\_tmp;}\_fi
481 }
482 \_def \_setletterspace #1{%
483 \_if^#1^\_def\_ffletterspace{}\_else \_edef\_ffletterspace{letterspace=#1;}\_fi
484 }
485 \_def \_setwordspace #1{%
486 \_if^#1^\_def\_setwsp##1{}\_def\_ffwordspace{}%
487 \_else \_def\_setwsp{\_setwspA#1/}\_def\_ffwordspace{+Ws;}\_fi
488 }
489 \_def\_setwsp #1{}
490 \_def\_setwspA #1{\_ifx/#1\_ea\_setwspB \_else\_afterfi{\_setwspC#1}\_fi}
491 \_def\_setwspB #1/#2/#3/#4{%
492 \_csname _sws:\_fontname#4\_endcsname \_relax
493 \_ea\_xdef \_csname _sws:\_fontname#4\_endcsname
494 {\_foreach 234\_do{\_fontdimen##1#4=\_the\_fontdimen##1#4}}%
495 \_fontdimen2#4=#1\_fontdimen2#4%
496 \_fontdimen3#4=#2\_fontdimen3#4\_fontdimen4#4=#3\_fontdimen4#4}
497 \_def\_setwspC #1/{\_setwspB #1/#1/#1/}
498
499 \_def\_calculatefontcolor#1{\_trycs{_fc:#1}{#1}} % you can define more smart macro ...
500 \_sdef{_fc:red}{FF0000FF} \_sdef{_fc:green}{00FF00FF} \_sdef{_fc:blue}{0000FFFF}
501 \_sdef{_fc:yellow}{FFFF00FF} \_sdef{_fc:cyan}{00FFFFFF} \_sdef{_fc:magenta}{FF00FFFF}
502 \_sdef{_fc:white}{FFFFFFFF} \_sdef{_fc:grey}{00000080} \_sdef{_fc:lgrey}{00000025}
503 \_sdef{_fc:black}{} % ... you can declare more colors...
504
505 \_public \setfontcolor \setletterspace \setwordspace ;
506
507 \_doc -----------------------------
508 \`\_regoptsizes` `<internal-template> <left-output>?<right-output> <resizing-data>`
509 prepares data for using by the \`\_optname` `<internal-template>` macro.
510 The data are saved to the `\_oz:<internal-template>` macro.
511 When the `\_optname` is expanded then the data are scanned by the macro
512 \`\_optnameA` `<left-output>?<right-output> <mid-output> `\code{<}`<size>`
513 in the loop.\nl
514 \`\_optfontalias` `{<template A>}{<template B>}` is defined as
515 `\let\_oz:<templateA>=\_oz:<templateB>`.
516 \_cod -----------------------------
517
518 \_def\_regoptsizes #1 #2?#3 #4*{\_sdef{_oz:#1}{#2?#3 #4* }}
519 \_def\_optname #1{\_ifcsname _oz:#1\_endcsname
520 \_ea\_ea\_ea \_optnameA \_csname _oz:#1\_ea\_endcsname
521 \_else \_failedoptname{#1}\_fi
522 }
523 \_def\_failedoptname #1{optname-fails:(#1)}
524 \_def\_optnameA #1?#2 #3 <#4 {\_ifx*#4#1#3#2\_else
525 \_ifdim\_optsize<#4pt #1#3#2\_optnameC
526 \_else \_afterfifi \_optnameA #1?#2 \_fi\_fi
527 }
528 \_def\_optnameC #1* {\_fi\_fi}
529 \_def\_afterfifi #1\_fi\_fi{\_fi\_fi #1}
530 \_def\_optfontalias #1#2{\_slet{_oz:#1}{_oz:#2}}
531
532 \_setfontsize {at10pt} % default font size
533
534 \_endcode %---------------------------------------------------
535
536
537 \sec[fontsystem] The Font Selection System
538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
539
540 The basic principles of the Font Selection System used in \OpTeX/
541 was documented in the section~\ref[fontfam].
542
543 \secc Terminology
544
545 We distinguish between
546 \begitems
547 * {\em font switches}, they are declared by the `\font` primitive or by
548 \^`\fontlet` or \~`\fontdef` macros, they select given font.
549 * {\em variant selectors}, there are four basic variant selectors
550 \^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, there is a special selector \^`\currvar`.
551 More variant selectors can be declared by the \~`\famvardef` macro.
552 They select the font depending on the given variant and on the {\em font context}
553 (i.e.\ on current family and on more features given by font modifiers).
554 In addition, \OpTeX/ defines \~`\tt` as variant selector
555 independent of chosen font family. It selects typewriter-like font.
556 * {\em font modifiers} are declared in a family (`\cond`, `\caps`) or are
557 \"built-in" (\^`\setfontsize``{<size spec>}`, \~`\setff{<features>}`).
558 They do appropriate change in the {\em font context} but do not select
559 the font.
560 * {\em family selectors} (for example `\Termes`, `\LMfonts`),
561 they are declared typically in the {\em font family files}.
562 They enable to switch between font families, they do appropriate
563 change in the {\em font context} but do not select
564 the font.
565 \enditems
566
567 These commands set their values locally. When the \TeX/ group is
568 left then the selected font and the {\em font context} are returned back to the values
569 used when the group was opened. They have the following features:
570
571 The {\em font context} is a set of macro values that will affect the
572 selection of real font when the variant selector is processed. It includes the
573 value of {\em current family}, current font size, and
574 more values stored by font modifiers.
575
576 The {\em family context} is the current family name stored in the font
577 context. The variant selectors declared by \~`\famvardef` and
578 font modifiers declared by \~`\moddef` are dependent on the {\em family context}.
579 They can have the same names but different behavior in different families.
580
581 The fonts registered in \OpTeX/ have their macros in the {\em font family files},
582 each family is declared in one font family file with the name `f-famname.opm`.
583 All families are collected in `fams-ini.opm` and users can give more
584 declarations in the file `fams-local.opm`.
585
586 \secc Font families, selecting fonts
587
588 The \^`\fontfam` `[<Font Family>]` opens the relevant font family file where
589 the `<Font Family>` is declared. The family selector is defined here by rules
590 described in the section~\ref[fontfamfiles]. Font modifiers and variant
591 selectors may be declared here.
592 The loaded family is set as current and `\rm` variant selector is processed.
593
594 When \^`\fontfam` `[<Font Family>]` is used and the given
595 family isn't found in the current \TeX/ system and
596 the <Font Family> is previously declared by
597 \^`\fontfamsub``[<Font Family>][<Other Family>]`
598 then \OpTeX/ does the given substitution and runs \^`\fontfam``[<Other Family>]`.
599
600 The available declared font modifiers and declared variant selectors are
601 listed in the log file when the font family is load. Or you can print
602 `\fontfam[catalog]` to show available font modifiers and variant selectors.
603
604 The font modifiers can be independent, like `\cond` and `\light`. They can
605 be arbitrarily combined (in arbitrary order) and if the font family disposes
606 of all such sub-variants then the desired font is selected (after variant
607 selector is used). On the other hand, there are font modifiers that negates
608 the previous font modifier, for example: `\cond`, `\extend`. You can reset
609 all modifiers to their initial value by the \^`\resetmod` command.
610
611 You can open more font families by more \^`\fontfam` commands. Then the
612 general method to selecting the individual font is:
613
614 \begtt \catcode`\<=13
615 <family selector> <font modifiers> <variant selector>
616 \endtt
617 For example:
618 \begtt
619 \fontfam [Heros] % Heros family is active here, default \rm variant.
620 \fontfam [Termes] % Termes family is active here, default \rm variant.
621 {\Heros \caps \cond \it The caps+condensed italics in Heros family is here.}
622 The Termes roman is here.
623 \endtt
624
625 There is one special command \^`\currvar` which acts as a variant selector.
626 It keeps the current variant and the font of such variant is
627 reloaded with respect to the current font context by the previously given family
628 selector and font modifiers.
629
630 You can use the \^`\setfontsize` `{<size spec>}` command in the same sense as
631 other font modifiers. It saves information about font size to the font
632 context. See section~\ref[setfontsize]. Example:
633
634 \begtt
635 \rm default size \setfontsize{at14pt}\rm here is 14pt size \it italic is
636 in 14pt size too \bf bold too.
637 \endtt
638
639 A much more comfortable way to resize fonts is using OPmac-like commands
640 \~`\typosize` and \~`\typoscale`.
641 These commands prepare the right sizes for math
642 fonts too and they re-calculate many internal parameters like `\baselineskip`.
643 See section~\ref[opmac-fonts] for more information.
644
645
646 \secc Math Fonts
647 %---------------
648
649 Most font families are connected with a preferred Unicode-math font. This
650 Unicode-math is activated when the font family is loaded. If you don't prefer
651 this and you are satisfied with 8bit math CM+AMS fonts preloaded in the
652 \OpTeX/ format then you can use command \^`\noloadmath` before you load a first
653 font family.
654
655 If you want to use your specially selected Unicode-math font then use
656 \^`\loadmath` `{[<font file>]}` or \^`\loadmath` `{<font name>}` before first
657 `\fontfam` is used.
658
659
660 \secc[fontcommands] Declaring font commands
661 %----------------------------
662
663 Font commands can be font switches, variant selectors, font modifiers,
664 family selectors and defined font macros doing something with fonts.
665
666 \begitems
667 * Font switches can be decared by `\font` primitive (see
668 section~\ref[fontprimitive]) or by \^`\fontlet` command (see
669 section~\ref[fontlet]) or by \~`\fontdef` command (see
670 sections~\ref[fontdef2]).
671 When the font switches are used then they select the given font independently
672 of the current font context. They can be used
673 in `\output` routine (for example) because we need to set fixed fonts
674 in headers and footers.
675 * Variant selectors are \^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, \~`\tt` and \^`\currvar`. More
676 variant selectors can be declared by \~`\famvardef` command. They select a
677 font dependent on the current font context, see section~\ref[famvardef].
678 The `\tt` selector is documented in section~\ref[tt].
679 * Font modifiers are \"built-in" or declared by \~`\moddef` command.
680 They do modifications in the font context but don't select any font.
681 \begitems
682 * \"built-in" font modifiers are \^`\setfontsize` (see
683 section~\ref[setfontsize]), \~`\setff` (see section~\ref[setff]),
684 \~`\setletterspace` and \~`\setwordspace`
685 (see section~\ref[specff]). They are independent of font family.
686 * Font modifiers declared by \~`\moddef` depend on the font family and they
687 are typically declared in font family files, see
688 section~\ref[fontfamfiles].
689 \enditems
690 * Family selectors set the given
691 font family as current and re-set data used by the family-dependent font
692 modifiers to initial values and to the currently used modifiers.
693 They are declared in font family files
694 by \~`\_famdecl` macro, see section~\ref[fontfamfiles].
695 * Font macros can be defined arbitrarily by `\def` primitive by users.
696 See an example in section~\ref[fontmacros].
697 \enditems
698
699 All declaration commands mentioned here: `\font`, `\fontlet`, `\fontdef`, `\famvardef`,
700 `\moddef`, `\_famdecl` and `\def` make local assignment.
701
702 \secc[fontdef2] The `\fontdef` declarator in detail
703
704 You can declare `\<font-switch>` by the \^`\fontdef` command.
705 \begtt \catcode`\<=13
706 \fontdef\<font-switch> {\<family selector> <font modifiers> \<variant selector>}
707 \endtt
708 %
709 where `\<family selector>` and `<font modifiers>` are optional and
710 `\<variant selector>` is mandatory.
711
712 The resulting `\<font-switch>` declared by \~`\fontdef` is \"fixed font switch"
713 independent of the font context. More exactly, it is
714 a fixed font switch when it is {\em used}. But it can depend on the current font
715 modifiers and font family and given font modifiers when it is {\em declared}.
716
717 The \^`\fontdef` does the following steps.
718 It pushes the current font context to a stack, it does modifications of the font
719 context by given `\<family selector>` and/or `<font modifiers>` and it
720 finds the real font by `\<variant selector>`. This font is not selected but
721 it is assigned to the declared `\<font switch>` (like `\font` primitive does
722 it). Finally, `\fontdef` pops the font context stack, so the current
723 font context is the same as it was before `\fontdef` is used.
724
725
726 \secc[famvardef] The `\famvardef` declarator
727
728 You can declare a new variant selector by the \^`\famvardef` macro. This
729 macro has similar syntax as \^`\fontdef`:
730 \begtt \catcode`\<=13
731 \famvardef\<new variant selector> {\<family selector> <font modifiers> \<variant selector>}
732 \endtt
733 %
734 where `\<family selector>` and `<font modifiers>` are optional and
735 `\<variant selector>` is mandatory.
736 The `\<new variant selector>` declared by `\famvardef` should be used in the same
737 sense as `\rm`, `\bf` etc. It can be used as the final command in next
738 \^`\fontdef` or \^`\famvardef` declarators
739 too. When the `\<new variant selector>` is used in the normal text then it does
740 the following steps: pushes current font context to a stack, modifies font
741 context by declared `\<family selector>` and/or `<font modifiers>`,
742 runs following `\<variant selector>`.
743 This last one selects a real font. Then pops the font context stack.
744 The new font is selected but the font context has its original values.
745 This is main difference between `\famvardef\foo{...}` and `\def\foo{...}`.
746
747 Moreover, the \^`\famvardef` creates the `\<new variant selector>` family dependent.
748 When the selector is used in another family context than it is defined then a warning is
749 printed on the terminal \"<var selector> is undeclared in the current family"
750 and nothing happens. But you can declare the same variant selector by
751 \^`\famvardef` macro in the context of a new family. Then the same command
752 may do different work depending on the current font family.
753
754 Suppose that the selected font family provides the font modifier `\medium` for
755 mediate weight of fonts. Then you can declare:
756 \begtt
757 \famvardef \mf {\medium\rm}
758 \famvardef \mi {\medium\it}
759 \endtt
760 Now, you can use six independent variant selectors `\rm`, `\bf`, `\it`,
761 `\bi`, `\mf` and `\mi` in the selected font family.
762
763 A `\<family selector>` can be written before `<font modifiers>` in the
764 `\famvardef` parameter. Then the `\<new variant selector>` is declared in
765 the current family but it can use fonts from another family represented by
766 the `\<family selector>`.
767
768 When you are mixing fonts from more families then you probably run
769 into a problem with incompatible ex-heights. This problem can be solved using
770 \^`\setfontsize` and \^`\famvardef` macros:
771 \begtt
772 \fontfam[Heros] \fontfam[Termes]
773
774 \def\exhcorr{\setfontsize{mag.88}}
775 \famvardef\rmsans{\Heros\exhcorr\rm}
776 \famvardef\itsans{\Heros\exhcorr\it}
777
778 Compare ex-height of Termes \rmsans with Heros \rm and Termes.
779 \endtt
780
781 The variant selectors (declared by \~`\famvardef`) or font
782 modifiers (declared by \~`\moddef`) are (typically) control sequences in the public
783 namespace (`\mf`, `\caps`). They are most often declared in font family files and
784 they are loaded by \^`\fontfam`. A conflict with such names in
785 the public namespace can be here. For example: if `\mf` is defined by a user and then
786 `\fontfam[Roboto]` is used then `\famvardef\mf` is performed for Roboto
787 family and the original meaning of `\mf` is lost. But \OpTeX/ prints warning
788 about it. There are two cases:
789
790 \begtt
791 \def\mf{Metafont}
792 \fontfam[Roboto] % warning: "The \mf is redefined by \famvardef" is printed
793 or
794 \fontfam[Roboto]
795 \def\mf{Metafont} % \mf variant selector redefined by user, we suppose that \mf
796 % is used only in the meaning of "Metafont" in the document.
797 \endtt
798
799 \secc[tt] The `\tt` variant selector
800
801 \^`\tt` is an additional special variant selector which is defined as \"select typewriter
802 font independently of the current font family". By default, the typewriter font-face
803 from LatinModern font family is used. When using this default `\tt` selector you need not to
804 load the LatinModern family (by \^`\fontfam[lm]`) because the font file is explicitly
805 specified in the macro \^`\_ttunifont`. The default `\tt` selector
806 scales this font without respecting optical sizes.
807
808 The \^`\tt` variant selector is used in \OpTeX/ internal macros
809 \^`\_ttfont` (verbatim texts), \^`\_urlfont` (printing URL's),
810 \^`\_printii` (printing index entry when doc macros are activated) and
811 \^`\ttraggedright` (plain~\TeX/ macro).
812
813 The \^`\tt` variant selector can be re-defined by \^`\famvardef`. For example:
814
815 \begtt
816 \fontfam[Cursor]
817 \fontfam[Heros]
818 \fontfam[Termes]
819 \famvardef\tt{\Cursor\setff{-liga;-tlig}\rm}
820
821 Test in Termes: {\tt text}. {\Heros\rm Test in Heros: {\tt text}}.
822 Test in URL \url{http://something.org}.
823 \endtt
824 %
825 You can see that \^`\tt` stay family independent. This is a special feature only
826 for \^`\tt` selector. It is recommended to use `\setff{-liga;-tlig}` to suppress the
827 ligatures in typewriter fonts.
828
829 The \^`\famvardef\tt` behaves differently than \^`\famvardef\anythingelse`:
830 it creates the \^`\tt` variant selector independent of current font family
831 and it redefines both macros `\tt` and `\_tt` in order to all internal \OpTeX/ macros
832 based on this selector are working with the new selected font.
833
834 If you load \^`\fontfam[lm]` and declare `\famvardef\tt{\LMfonts\ttset\setff{-tlig}\rm}`
835 then you get almost the same behavior as the default `\tt` selector does with one
836 difference: a new `\tt` selector respects optical sizes declared in
837 the LatinModern font family.
838
839 You can implement ex-height correction of `\tt` font with
840 respect to your font family used for general text. For example:
841
842 \begtt
843 \load[lm]
844 \famvardef\tt{\LMfonts\ttset\setfontsize{mag1.1}\setff{-tlig}\rm}
845 ... or ...
846 \let\oritt=\tt
847 \famvardef\tt{\setfontsize{mag1.1}\oritt}
848 \endtt
849 The second alternative uses the default font from \^`\_ttunifont` without
850 respecting optical sizes.
851
852 If Unicode math font is loaded then the `\tt` macro selects typewriter
853 font-face in math mode too. This face
854 is selected from used Unicode math font and it is independent of
855 `\famvardef\tt` declaration.
856
857
858 \secc[fontmacros] Font commands defined by `\def`
859
860 Such font commands can be used as fonts selectors for titles, footnotes,
861 citations, etc. Users can define them.
862
863 The following example shows how to define a \"title-font selector".
864 Titles are not only bigger but they are typically in the bold variant. When a user puts
865 `{\it...}` into the title text then he/she expects bold italic here, no normal
866 italic. You can remember the great song by John Lennon \"Let It Be" and
867 define:
868
869 \begtt
870 \def\titlefont{\setfontsize{at14pt}\bf \let\it\bi}
871 ...
872 {\titlefont Title in bold 14pt font and {\it bold 14pt italics} too}
873 \endtt
874
875 \OpTeX/ defines similar internal commands \^`\_titfont`, \^`\_chapfont`, \^`\_secfont` and
876 \^`\_seccfont`, see section~\ref[sections]. The commands \^`\typosize` and
877 \^`\boldify` are used in these macros. They set the math fonts to given size too and they
878 are defined in section~\ref[opmac-fonts].
879
880
881 \secc[setff] Modifying font features
882 %----------------------------
883
884 Each OTF font provides \"font features". You can list these font features
885 by `otfinfo -f font.otf`. For example, LinLibertine fonts provide `frac` font
886 feature. If it is active then fractions like 1/2 are printed in a special
887 form.
888
889 The font features are part of the font context data.
890 The macro \^`\setff` `{<feature>}` acts like family independent font modifier and
891 prepares a new <feature>. You must use a variant selector in order to
892 reinitialize the font with the new font feature. For example
893 \^`\setff``{+frac}\rm` or \^`\setff``{+frac}`\^`\currvar`. You can declare a new variant
894 selector too:
895
896 \begtt
897 \fontfam[LinLibertine]
898 \famvardef \fraclig {\setff{+frac}\currvar}
899 Compare 1/2 or 1/10 \fraclig to 1/2 or 1/10.
900 \endtt
901
902 If the used font does not support the given font feature then the font is reloaded
903 without warning nor error, silently. The font feature is not activated.
904
905 The `onum` font feature (old-style digits) is connected to `\caps` macro for
906 Caps+SmallCaps variant in \OpTeX/ font family files. So you need not
907 create a new modifier, just use `{\caps`\^`\currvar`` 012345}`.
908
909
910 \secc[specff] Special font modifiers
911 %---------------------------
912
913 Despite the font modifiers declared in the font family file (and dependent on
914 the font family), we have following font modifiers (independent of font
915 family):
916
917 \begtt \catcode`\<=13
918 \setfontsize{<size spec>} % sets the font size
919 \setff{<font feature>} % adds the font feature
920 \setletterspace{<number>} % sets letter spacing
921 \setwordspace{<scaling>} % modifies word spacing
922 \endtt
923
924 The \^`\setfontsize` command is described in the section \ref[setfontsize].
925 The \^`\setff` command was described in previous subsection.
926
927 \^`\setletterspace` `{<number>}` specifies the letter spacing of the font. The
928 `<number>` is a decimal number without unit. The unit is supposed as 1/100 of
929 the font size. I.e. `2.5` means 0.25 pt when the font is at 10 pt size. The
930 empty parameter `<number>` means no letter spacing which is the default.
931
932 \^`\setwordspace` `{<scaling>}` scales the default interword space (defined in the
933 font) and its stretching and shrinking parameters by given `<scaling>`
934 factor. For example `\setwordspace{2.5}` multiplies interword space by 2.5.
935 \^`\setwordspace` can use different multiplication factors if its parameter is in the
936 format `{/<default>/<stretching>/<shrinking>}`. For example,
937 `\setwordspace{/1/2.5/1}` enlarges only stretching 2.5~times.
938
939 You can use `\setff` with other font features provided by Lua\TeX/ and `luaotfload` package
940 (see documentation of `loaotfload` package for more information):
941
942 \begtt
943 \setff{embolden=1.5}\rm % font is bolder because outline has nonzero width
944 \setff{slant=0.2}\rm % font is slanted by a linear transformation
945 \setff{extend=1.2}\rm % font is extended by a linear transformation.
946 \setff{colr=yes}\rm % if the font includes colored characters, use colors
947 \setff{upper}\rm % to uppercase (lower=lowecase) conversion at font level
948 \setff{fallback=name}\rm % use fonts from a list given by name if missing chars
949 \endtt
950
951 Use font transformations `embolden`, `slant`, `extend` and \^`\setletterspace`,
952 \^`\setwordspace` with care. The best setting of these values is the default
953 setting in every font, of course. If you really need to set a different
954 letter spacing then it is strongly recommended to add `\setff{-liga}`
955 to disable ligatures. And setting a positive letter spacing probably
956 needs to scale interword spacing too.
957
958 All mentioned font modifiers (except for `\setfontsize`) work only
959 with Unicode fonts loaded by \^`\fontfam`.
960
961 \secc[fontfamfiles] How to create the font family file
962 %------------------------------------------------------
963
964 \printdoctail f-heros.opm
965
966 \printdoctail f-lmfonts.opm
967
968 \secc How to register the font family in the Font Selection System
969 %---------------------------------------------------------------
970
971 \printdoctail fams-ini.opm
972
973 \endinput
974
975 2025-06-29 \_onlyif is expandable.
976 2023-06-16 \fontfamsub improved.
977 2023-05-30 \catalognextfam introduced.
978 2023-04-22 \setwordspace: \fontdimens reset, bug fixed.
979 2023-03-09 \_famsrc, \fontfamsub introduced
980 2022-12-01 \faminfo saves f-<filename> to the format only when needed
981 2022-11-08 \protected: \fontdef, \famvardef, \fontfam
982 2022-02-22 Font Selection System reimplemented, \fontsel introduced
983 2021-09-24 \_unichars used in \initunifonts
984 2021-07-16 \initunifonts: optex_hook_into_luaotfload added.
985 2021-05-23 concept of \_fontfeatures macro re-implemented
986 2021-05-02 simpler \_resizefont, better concept of doc, moving parts from fonts-resize
987 2021-04-22 \_ffonum introduced
988 2021-04-19 \setwordspace: parameter format {/A/B/C} implemented.
989 2021-02-25 \_ttunifont introduced
990 2021-01-27 lua hack (print function) removed because luaotfload 3.17 removes bug.
991 2020-12-12 \_modlist added, doc improved
992 2020-04-18 \_tryloadfamslocal introduced
993 \_fontdecl -> \_famdecl with different concept
994 2020-03-18 released