diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/optex/base/fonts-select.opm')
-rw-r--r-- | Master/texmf-dist/tex/luatex/optex/base/fonts-select.opm | 377 |
1 files changed, 260 insertions, 117 deletions
diff --git a/Master/texmf-dist/tex/luatex/optex/base/fonts-select.opm b/Master/texmf-dist/tex/luatex/optex/base/fonts-select.opm index 8e7ab81fcf4..20a8ead2b5f 100644 --- a/Master/texmf-dist/tex/luatex/optex/base/fonts-select.opm +++ b/Master/texmf-dist/tex/luatex/optex/base/fonts-select.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \fontfam {Fonts selection system <2020-03-18>} % preloaded in format +\_codedecl \fontfam {Fonts selection system <2020-12-12>} % preloaded in format \_doc ----------------------------- \`\initunifonts` macro extends \LuaTeX's font capabalities, @@ -41,29 +41,33 @@ The \`\_famdecl` `[<Family Name>] \<Famselector> {<comment>} {<modifiers>} {<variants>} {<math>}`\nl `{<font for testing>} {\def`\^`\_fontnamegen``{<data>}}` runs \^`\initunifonts`, then checks if `\<Famselector>` is defined. If it is true, then closes the file by - `\endinput`. Else it defines `\<Famselector>` and saves it to the \`\_mainfamcommand` - macro because the \`\_initfontfamily` needs it. The \`\_currfamily` is set + `\endinput`. Else it defines `\<Famselector>` and saves it to the + internal `\_f:<currfamily>:main.fam` command. + The macro \`\_initfontfamily` needs it. The \`\_currfamily` is set to the `<Famselector>` because the following \^`\moddef` commands need to be in the right font family context. The `\_currfamily` is set to the `<Famselector>` by the `\<Famselector>` too, because `\<Famselector>` - must set the right faily context. The font family context is given by the current - `\_currfamily` value and by the actual meaning of the \^`\_fontnamegen` macro. + must set the right font family context. The font family context is given by the current + `\_currfamily` value and by the actual meaning of the \^`\_fontnamegen` macro. + The \`\_mathfaminfo` is saved for usage in the catalogue. \_cod ----------------------------- \_def\_famdecl [#1]#2#3#4#5#6#7#8{% \_initunifonts \_uniaccents - \_ifx #2\_undefined + \_unless\_ifcsname _f:\_csstring#2:main.fam\_endcsname \_isfont{#7}\_iffalse \_opwarning{Family [#1] skipped, font "#7" not found}\_ea\_ea\_ea\_endinput \_else - \_edef\_currfamily {\_csstring #2}% - \_def\_mainfamcommand{#2}\_def\_mathfaminfo{#6}% - \_protected\_edef#2{\_def\_noexpand\_currfamily{\_csstring #2}\_unexpanded{#8\_resetmod}}% + \_edef\_currfamily {\_csstring #2}\_def\_mathfaminfo{#6}% \_wterm {FONT: [#1] -- \_string#2 \_detokenize{(#3)^^J mods:{#4} vars:{#5} math:{#6}}}% + \_unless \_ifx #2\_undefined + \_opwarning{\_string#2 is redefined by \_string\_famdecl\_space[#1]}\_fi + \_protected\_edef#2{\_def\_noexpand\_currfamily{\_csstring #2}\_unexpanded{#8\_resetfam}}% + \_ea \_let \_csname _f:\_currfamily:main.fam\_endcsname =#2% \_fi - \_else \_ea #2\_ea\_endinput \_fi + \_else \_csname _f:\_csstring#2:main.fam\_endcsname \_reloading \_rm \_ea \_endinput \_fi } \_def\_initfontfamily{% - \_mainfamcommand \_reloading \_rm + \_csname _f:\_currfamily:main.fam\_endcsname \_reloading \_rm } \_doc ----------------------------- @@ -101,12 +105,15 @@ `<variant name>`. Usable only of standard four variants. Next variants can be declared by the \^`\famvardef` macro. \nl - \`\_fset` `<key>=<value>,...,<key>=<value>` expands to + \`\_fsetV` `<key>=<value>,...,<key>=<value>` expands to `\def\_<key>V{<value>}` in the loop. \nl \`\_onlyif` `<key>=<value-a>,<value-b>...,<value-z>: {<what>}` runs <what> only if the `\_<key>V` is defined as `<value-a>` or `<value-b>` or ... or `<value-z>`. + \nl + \`\_prepcommalist` `ab,{},cd,\_end,` expands to `ab,,cd,` (auxiliary macro + used in `\_onlyif`). \_cod ----------------------------- \_def\_fvars #1 #2 #3 #4 {% @@ -125,9 +132,10 @@ \_ifx,#1\_else\_sdef{_#1V}{#2}\_ea\_ea\_ea\_fsetVa\_fi\_fi } \_def \_onlyif #1=#2:#3{% - \_edef\_act{\_noexpand\_isinlist{,#2,}{,\_cs{_#1V},}}\_act + \_edef\_act{\_noexpand\_isinlist{,\_prepcommalist #2,\_end,}{,\_cs{_#1V},}}\_act \_iftrue #3\_fi } +\_def\_prepcommalist#1,{\_ifx\_end#1\_empty\_else #1,\_ea\_prepcommalist\_fi} \_doc ----------------------------- The \`\moddef` `\<modifier> {<data>}` simply speaking does @@ -145,22 +153,43 @@ `_<something>` or to `<something>`. The `\_remifirstunderscore` redefines `\_tmp` in the way that it expands only to `<something>` without the first `_`. + + \`\_setnewmeaning` `<cs-name>=\_tmpa <by-what>` does exactly `\_let <csname>=\_tmpa` + but warning is printed if <cs-name> is defined already and it is not a variant + selector or font modifier. + + \`\_addtomodlist` `<font modifier>` adds given modifier to \`\_modlist` + macro. This list is used after `\resetmod` when new family is selected by + a family selector, see \`\_resetfam` macro. + This allows to reinitialize the same current modifiers in the font context + after family is changed. \_cod ----------------------------- -\_def \_moddef #1#2{\_edef\_tmp{\_csstring#1}\_remfirstunderscore\_tmp - \_sdef{_f:\_currfamily:\_tmp}{#2\_reloading}% - \_protected \_edef #1{\noexpand\_famdepend\noexpand#1{_f:\noexpand\_currfamily:\_tmp}}% - \_ea \_ifx \_csname\_tmp\_endcsname #1\_else - \_ea \_public \_csname\_tmp\_endcsname ;\_fi +\_def \_moddef #1#2{\_edef\_tmp{\_csstring#1}% + \_sdef{_f:\_currfamily:\_tmp}{\_addtomodlist#1#2\_reloading}% + \_protected \_edef \_tmpa{\_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_tmp}}% + \_setnewmeaning #1=\_tmpa \moddef } -\_def\_remfirstunderscore#1{\_ea\_remfirstunderscoreA#1\_relax#1} -\_def\_remfirstunderscoreA#1#2\_relax#3{\_if _#1\_def#3{#2}\_fi} - \_protected \_def\_resetmod {\_cs{_f:\_currfamily:resetmod}} % private variant of \resetmod -\_def\_currfamily{} % default current family is empty +\_def \_resetfam{\_def\_addtomodlist##1{}\_resetmod + \_edef \_modlist{\_ea}\_modlist + \_let\_addtomodlist=\_addtomodlistb +} +\_def \_currfamily{} % default current family is empty +\_def \_modlist{} % list of currently used modifiers + +\_def \_addtomodlist#1{\_addto\_modlist#1} +\_let \_addtomodlistb=\_addtomodlist \_def\_famdepend#1#2{\_ifcsname#2\_endcsname \_csname#2\_ea\_endcsname \_else - \_opwarning{\_string#1 is undeclared in current family "\_currfamily", ignored}\_fi + \_ifx\_addtomodlist\_addtomodlistb + \_opwarning{\_string#1 is undeclared in family "\_currfamily", ignored}\_fi\_fi +} +\_def\_setnewmeaning #1=\_tmpa#2{% + \_ifx #1\_undefined \_else \_ifx #1\_tmpa \_else + \_opwarning{\_string#1 is redefined by \_string#2}% + \_fi\_fi + \_let#1=\_tmpa } \_public \moddef ; @@ -171,27 +200,29 @@ \`\_famvardefA` `\<XX> \_ten<XX> \_tryload<XX> {<data>}` is used. It does: \begitems - * `\protected\def \<XX> {\_famdepend \<XX> {_f:\_currfamily:<XX>}}`, - * `\def \_f:<current family>:<XX> {\_tryload<XX>\_ten<XX>}` keeps family dependent definition, - * `\def \_tryload<XX> {`\^`\fontdef`` \_ten<XX> {<data>}}` loads actually the font `\_ten<XX>`, - * `\def \_currvar:_ten<XX> {\<XX>}` in ordef to the \^`\currvar` macro - work correctly. + * `\def \_tryload:<currfam>:<XX> {`\^`\fontdef`` \_ten<XX> {<data>}}` loads font `\_ten<XX>`, + * `\protected\def \<XX> {\_famdepend \<XX> {_f:<currfam>:<XX>}}`, + * `\def \_f:<currfam>:<XX> {\_tryload:<currfam>:<XX>\_ten<XX>}` keeps family dependent definition, + * `\def \_currvar:_ten<XX> {\<XX>}` in order to the \^`\currvar` macro work correctly. \enditems + `\famvardef\tt` behaves somewhat differently: it doesn't re-define the + `\tt` macro which is defined as `\_tryloadtt \_tentt` in sections~\ref[math-preload] + and~\ref[unimath-codes]. It only re-defines the internal `\_tryloadtt` macro. \_cod ----------------------------- -\_def\_famvardef#1{\_edef\_tmp{\_csstring#1}\_remfirstunderscore\_tmp +\_def\_famvardef#1{\_edef\_tmp{\_csstring#1}% \_ea\_famvardefA \_ea#1\_csname _ten\_tmp\_ea\_endcsname - \_csname _tryload:\_tmp\_endcsname + \_csname _tryload:\_currfamily:\_tmp\_endcsname } -\_def\_famvardefA #1#2#3#4{% #1=\_XX #2=\_tenXX #3=\_tryloadXX #4=data +\_def\_famvardefA #1#2#3#4{% #1=\XX #2=\_tenXX #3=\_tryload:currfam:XX #4=data \_isinlist{.\_rm\_bf\_it\_bi\currvar\_currvar}#1\_iftrue \_opwarning{\_string\famvardef: - You cannot re-declare private standard variant selector \_string#1}% + You cannot re-declare standard variant selector \_string#1}% \_else - \_protected\_edef #1{\_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_tmp}}% - \_sdef{_f:\_currfamily:\_tmp}{#3#2}% \_def#3{\_fontdef#2{#4}}% - \_ifx#1\tt \_addto#1{\_fam\_ttfam}\_fi + \_protected\_edef\_tmpa{\_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_tmp}}% + \_ifx #1\_tt \_let\_tryloadtt=#3\_else \_setnewmeaning #1=\_tmpa \famvardef \_fi + \_sdef{_f:\_currfamily:\_tmp}{#3#2}% \_sdef{_currvar:\_csstring#2}{#1}% \_fi } @@ -225,7 +256,7 @@ } \_def\_tryloadfamslocal{% \_isfile {fams-local.opm}\_iftrue - \_opinput {fams-local.opm} + \_opinput {fams-local.opm}\_famfrom={}% \_fi \_let \_tryloadfamslocal=\_relax % need not to load fams-local.opm twice } @@ -236,7 +267,7 @@ \_def\_faminfo [##1]##2##3##4{% \_wterm{ \_space\_noexpand\fontfam [##1] -- ##2}% \_let\_famalias=\_famaliasA}% - \_opinput {fams-ini.opm} + \_opinput {fams-ini.opm}% \_isfile {fams-local.opm}\_iftrue \_opinput {fams-local.opm}\_fi \_message{^^J}% \_endgroup @@ -247,8 +278,8 @@ \_public \fontfam ; \_doc ----------------------------- - When the `fams-ini.opm` or `fams-loca.opm` files are read then we need - to save ony a mapping from family names or alias names to the font family file + When the `fams-ini.opm` or `fams-local.opm` files are read then we need + to save only a mapping from family names or alias names to the font family file names. All other information is ignored in this case. But if these files are read by the `\_listfamnames` macro or when printing a catalog then more infrormation is used and printed.\nl @@ -260,7 +291,11 @@ \nl \`\_famalias` `[<Family Alias>]` does `\def \_famf:<familyalias> {<file-name>}` where `<file-name>` is stored from the previous `\_faminfo` command. Or - prints information on the terminal. + prints information on the terminal. + \nl + \`\_famfrom` declares type foundry or owner or designer of the font family. + It can be used in `fams-ini.opm` or `fams-local.opm` and it is printed + in the font catalog. \_cod ----------------------------- \_def\_famtext #1{} @@ -273,8 +308,10 @@ \_lowercase{\_edef\_famname{\_ea\_removespaces #1 {} }}% \_sdef{_famf:\_famname\_ea}\_ea{\_famfile}% } +\_newtoks\_famfrom \_input fams-ini.opm \_let\_famfile=\_undefined +\_famfrom={} \_doc ----------------------------- When the \^`\fontfam``[catalog]` is used then the file @@ -372,34 +409,38 @@ was documented in the section~\ref[fontfam]. We distinguish between \begitems * {\em font switchers}, they are declared by the `\font` primitive or by - \^`\fontlet` or \^`\fontdef` macros, + \^`\fontlet` or \~`\fontdef` macros, they select given font. * {\em variant selectors}, there are four basic variant selectors - `\rm`, `\bf`, `\it`, `\bi`, there is a special selector `\currvar` - and more variant selectors can be declared by the \^`\famvardef` macro. -* {\em font modifiers} (for example `\cond`, `\caps`, \^`\setfontsize``{<size spec>}`), - they are in two types: bulid in (like \^`\setfontsize`) or - declared modifiers (by by the \^`\moddef` macro). + \^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, there is a special selector \^`\currvar`. + More variant selectors can be declared by the \~`\famvardef` macro. + They select the font depending on given variant and on the {\em font context} + (i.e.\ on current family and on more features given by font modifiers). + In addition, \OpTeX/ defines \~`\tt` as variant selector + independent of chosen font family. It selects typewriter-like font. +* {\em font modifiers} are declared in a family (`\cond`, `\caps`) or are + \"build in" (\^`\setfontsize``{<size spec>}`, \~`\setff{<features>}`). + They do appropriate change in the {\em font context} but do not select + the font. * {\em family selectors} (for example `\Termes`, `\LMfonts`), - they are declared typically in the {\em font family files}. + they are declared typically in the {\em font family files}. + They enable to swithch between font families, they do appropriate + change in the {\em font context} but do not select + the font. \enditems -These selectors / switchers sets its values locally. When the \TeX/ group is +These commands set their values locally. When the \TeX/ group is leaved then selected font and the {\em font context} are returned back to the values used when the group was opened. They have the following features: -\begitems -* The {\em font switchers} select fonts independent on the font context. -* The {\em variant selectors} select the font depending on the font context and on - the specified variant. -* The {\em font modifiers} create a change in the font context but they - don't select the font itself. -* The {\em family selectors} set a family in the font context and resets all - font modifiers. They dont't select the font itself. -\enditems +The {\em font context} is a set of macro values which will affect the +selection of real font when variant selector is processed. It includes the +value of {\em current family}, current font size and +more values stored by font modifiers. -The variant selectors and declared font modifiers are -defined in the family context. They can behave differently in different -families. +The {\em family context} is the current family value stored in the font +context. The variant selectors declared by \~`\famvardef` and +font modifiers declared by \~`\moddef` are dependent on the {\em family context}. +They can have the same names but different behavior in different families. The fonts registered in \OpTeX/ have their macros in the {\em font family files}, each family is declared in one font family file with the name `f-famname.opm`. @@ -411,8 +452,8 @@ declarations in the file `fams-local.opm`. The \^`\fontfam` `[<Font Family>]` opens the relevant font family file where the `<Font Family>` is declared. The family selector is defined here by rules described in the section~\ref[fontfamfiles]. Font modifiers and variant -selectors may be declared here. Their definitions depends on given family. -The family is set as active in the font context and `\rm` variant selector is run. +selectors may be declared here. +The loaded family is set as current and `\rm` variant selector is processed. The available declared font modifiers and declared variant selectors are listed in the log file when font family is load. Or you can print @@ -445,7 +486,7 @@ reloaded with respect to the current font context by previously given family selector and font modifiers. You can use the \^`\setfontsize` `{<sizespec>}` command in the same sense as -other font modifiers. It saves only information about font size to the font +other font modifiers. It saves information about font size to the font context. See section~\ref[setfontsize]. Example: \begtt @@ -453,10 +494,10 @@ context. See section~\ref[setfontsize]. Example: in 14pt size too \bf bold too. \endtt -Much more comfortable way to resize fonts is using OPmac-like command -`\typosize`, `\typoscale`. +Much more comfortable way to resize fonts is using OPmac-like commands +\~`\typosize` and \~`\typoscale`. These commands prepare the right sizes for math -fonts too and re-calculates many internal parameters like `\baselineskip`. +fonts too and they re-calculate many internal parameters like `\baselineskip`. See section~\ref[opmac-fonts] for more information. @@ -474,74 +515,106 @@ If you want to use your specially selected Unicode-math font then use `\fontfam` is used. -\secc Declaring font commands +\secc[fontcommands] Declaring font commands %---------------------------- -The font switches can be declared by `\font` primitive or by \^`\fontdef` or -\^`\fontlet` macros. See the sections~\ref[fontdef] and~\ref[fontlet] -for more details. The general format for \^`\fontdef` is +Font commands can be font switches, variant selectors, font modifiers, +family selectors and defined font macros doing something with fonts. + +\begitems +* Font switches can be decared by `\font` primitive (see + section~\ref[fontprimitive]) or by \^`\fontlet` command (see + section~\ref[fontlet]) or by \~`\fontdef` command (see + sections~\ref[fontdef2] and~\ref[fontdef]). + When the font switches are used then they select given font independently + of current font context. They can be used + in `\output` routine (for example) becuase we need to set fixed fonts + in hedares and footers. +* Variant selectors are \^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, \~`\tt` and \^`\currvar`. More + variant selectors can be declared by \~`\famvardef` command. They select a + font dependent on the current font context, see section~\ref[famvardef]. + The `\tt` selector is documented in section~\ref[tt]. +* Font modifiers are \"build in" or declared by \~`\moddef` command. + They do modifications in the font context but don't select any font. + \begitems + * \"build-in" font modifiers are \^`\setfontsize` (see + section~\ref[setfontsize]), \~`\setff` (see section~\ref[setff]), + \~`\setfontcolor`, \~`\setletterspace` and \~`\setwordspace` + (see section~\ref[specff]). They are independent of font family. + * Font modifiers declared by \~`\moddef` depend on the font family and they + are typicaly declared in font family files, see + section~\ref[fontfamfiles]. + \enditems +* Family selectors set the given + font family as current and re-set data used by family-dependent font + modifiers to initial values and to the currently used modifiers. + They are declared in font family files + by \~`\_famdecl` macro, see section~\ref[fontfamfiles]. +* Font macros can be defined arbitrary by `\def` primitive by user. + See an example in section~\ref[fontmacros]. +\enditems + +All declaration commands mentioned here: `\font`, `\fontlet`, `\fontdef`, `\famvardef`, +`\moddef`, `\_famdecl` and `\def` make local assignment. + +\secc[fontdef2] The `\fontdef` declarator in detail + +The general format for \^`\fontdef` usage is \begtt \catcode`\<=13 \fontdef\<font switch> {\<family selector> <font modifiers> \<variant selector>} \endtt +% +where `\<family selector>` and `<font modifiers>` are optional and +`\<variant selector>` is mandatory. -Such font switches should be used in `\output` routine (headers, footers) for -example. We need fixed sizes here. But they are less usable in common -text. For example the document includes notices in smaller font. -When the notice is started then we want -to do all variants smaller: `\rm`, `\it`, `\bf`, etc. -It means that the smaller font for notices should be initialized by -`\setfontsize{at9pt}\rm` for example. If you want a \"notices font selector" -then you can do `\def\noticefont{\setfontsize{at9pt}\rm}`. This font -selector does not change the `\baselineskip`. If you want to do this then -put different `\baselineskip` setting to your definition. But you must not -forget that the end of group before `\par` is a typical mistake of \TeX/ -users: the last paragraph is in smaller font but in normal baselineskip, -because `\baselineskip` setting is taken into account when `\par` -command is processed. - -Somewhat more complicated task is the \"title font selector", because titles are -not only bigger but they are typically in bold variant. When the user puts -`{\it...}` into the title then he/she expects bold italic here, no normal -italic. You can remember the great song by John Lennon \"Let It Be" and -define: +The \^`\fontdef` does following steps. +It pushes current font context to a stack, it do modifications of the font +context by given `\<family selector>` and/or `<font modifiers>` and it +find the real font by `\<variant selector>`. This font is not selected but +it is assigned to the declared `\<font switch>` (like `\font` primitive does +it). Finally, `\fontdef` pops the font context stack, so the current +font context is the same as it was before `\fontdef` is used. + +More about `\fontdef` command including examples is written in +section~\ref[fontdef]. -\begtt -\def\titlefont{\setfontsize{at14pt}\bf \let\it\bi} -... -{\titlefont here we have bold 14pt font and {\it here} was bold 14pt italics} -\endtt -You can declare a new variant slector by the \^`\famvardef` macro. This +\secc[famvardef] The `\famvardef` declarator + +You can declare a new variant selector by the \^`\famvardef` macro. This macro has similar syntax as \^`\fontdef`: \begtt \catcode`\<=13 -\famvardef\<new variant selector> {<font modifiers> \<variant selector>} +\famvardef\<new variant selector> {\<family selector> <font modifiers> \<variant selector>} \endtt % +where `\<family selector>` and `<font modifiers>` are optional and +`\<variant selector>` is mandatory. The `\<new variant selector>` should be used in the same sense as `\rm`, -`\bf` etc. It can be used as the final command in the -`\fontdef` or `\famvardef` declarators +`\bf` etc. It can be used as the final command in next +\^`\fontdef` or \^`\famvardef` declarators too. When the `\<new variant selector>` is used in normal text then it does following steps: pushes current font context to a stack, modifies font -context by declared `<font modifiers>`, runs following `\<variant selector>`. -It selects a font. Then pops the stack. The font context have its original -values but new font is selected. - -The \^`\famvardef` creates the `\<new variant selector>` family dependent. -When the selector is used in another family than it is defined then warning is +context by declared `\<family selector>` and/or `<font modifiers>`, +runs following `\<variant selector>`. +This last one selects a real font. Then pops the font context stack. +The new font is selected but the font context has its original values. +This is main difference between `\famvardef\foo{...}` and `\def\foo{...}`. + +Moreover, the \^`\famvardef` creates the `\<new variant selector>` family dependent. +When the selector is used in another family context than it is defined then warning is printed on the terminal \"<var selector> is undeclared in current family" and nothing happens. But you can declare the same variant selector by \^`\famvardef` macro in the context of new family. Then the same command -will be do different work depending on the current font family. +may do different work depending on the current font family. Suppose that the selected font family provides the font modifier `\medium` for -mediate weight of fonts but supports only basic variant selectors `\rm`, `\bf`, `\it`, -and `\bi`. Then you can declare: +mediate weight of fonts. Then you can declare: \begtt -\famvardef \mr {\medium\rm} +\famvardef \mf {\medium\rm} \famvardef \mi {\medium\it} \endtt Now, you can use six independent variant selectors `\rm`, `\bf`, `\it`, -`\bi`, `\mr` and `\mi` in the selected font family. +`\bi`, `\mf` and `\mi` in the selected font family. A `\<family selector>` can be written before `<font modifiers>` in the `\famvardef` parameter. Then the `\<new variant selector>` is declared in @@ -561,11 +634,80 @@ into problem with incompatible ex-heights. This problem can be solved using Compare ex-height of Termes \rmsans with Heros \rm and Termes. \endtt -There exists analogical declarator `\moddef` for declaration family dependent -font modifiers. It is described in detail the section~\ref[fontfamfiles]. +The variant selectors (declared by \~`\famvardef`) or font +modifiers (declared by \~`\moddef`) are (typically) control sequences in user name +space (`\mf`, `\caps`). They are most often declared in font family files and +they are loaded by \^`\fontfam`. A conflict with such names in +user name space can be here. For example: if `\mf` is defined by user and then +`\fontfam[Roboto]` is used then `\famvardef\mf` is performed for Roboto +family and the original meaning of `\mf` is lost. But \OpTeX/ prints warning +about it. There are two cases: + +\begtt +\def\mf{Metafont} +\fontfam[Roboto] % warning: "The \mf is redefined by \famvardef" is printed + or +\fontfam[Roboto] +\def\mf{Metafont} % \mf variant selector redefined by user, we suppose that \mf + % is used only in the meaning of "Metafont" in the document. +\endtt + +\secc[tt] The `\tt` variant selector + +\^`\tt` is additional special variant selector which is defined as \"select typewriter +font independently of current font family". By default, the typewriter font-face +from LatinModern font family is used. + +The \^`\tt` variant selector is used in \OpTeX/ internal macros +\^`\_ttfont` (verbatim texts) and \^`\_urlfont` (printing URL's). + +You can redefine the behavior of `\tt` by \^`\famvardef`. For example: + +\begtt +\fontfam[Cursor] +\fontfam[Heros] +\fontfam[Termes] +\famvardef\tt{\Cursor\setff{-liga;-tlig}\rm} + +Test in Termes: {\tt text}. {\Heros\rm Test in Heros: {\tt text}}. +Test in URL \url{http://something.org}. +\endtt +% +You can see that `\tt` stay family independent. This is special feature only +for `\tt` selector. New definition is used in \^`\_ttfont` and \^`\_urlfont` too. +It is recommended to use `\setff{-liga;-tlig}` in order to supress the +liguatures in typewriter fonts. + +If Unicode math font is loaded then the `\tt` macro selects typewriter +font-face in math mode too. This face +is selected from used Unicode math font and it is independent of +`\famvardef\tt` declaration. + + +\secc[fontmacros] Font commands defined by `\def` + +Such font commands can be used as fonts selectors for titles, footnotes, +ctitations etc. User can define them. + +The following example shows how to define a \"title-font selector". +Titles are not only bigger but they are typically in bold variant. When the user puts +`{\it...}` into the title text then he/she expects bold italic here, no normal +italic. You can remember the great song by John Lennon \"Let It Be" and +define: + +\begtt +\def\titlefont{\setfontsize{at14pt}\bf \let\it\bi} +... +{\titlefont Title in bold 14pt font and {\it bold 14pt italics} too} +\endtt + +\OpTeX/ defines similar internal commands \^`\_titfont`, \^`\_chapfont`, \^`\_secfont` and +\^`\_seccfont`, see section~\ref[sections]. The commands \^`\typosize` and +\^`\boldify` are used in these macros. They set the math fonts to given size too and they +are defined in section~\ref[opmac-fonts]. -\secc Modifying font features +\secc[setff] Modifying font features %---------------------------- Each OTF font provides \"font features". You can list these font features @@ -581,9 +723,9 @@ reinitialize the font with the new font feature. For example selector too: \begtt - \fontfam[LinLibertine] - \famvardef \fraclig {\setff{+frac}\currvar} - Compare 1/2 or 1/10 \fraclig to 1/2 or 1/10. +\fontfam[LinLibertine] +\famvardef \fraclig {\setff{+frac}\currvar} +Compare 1/2 or 1/10 \fraclig to 1/2 or 1/10. \endtt If the used font does not supports given font feature then font is realoaded @@ -594,7 +736,7 @@ Caps+SmallCaps variant in \OpTeX/ font family files. So you need not to create a new modifier, just use `{\caps`\^`\currvar`` 012345}`. -\secc Special font modifiers +\secc[specff] Special font modifiers %--------------------------- Despite the font modifiers declared in the font family file (and dependent on @@ -694,6 +836,7 @@ Luaotfload documentation for more information. \endinput +2020-12-12 \_modlist added, doc improved 2020-04-18 \_tryloadfamslocal introduced \_fontdecl -> \_famdecl with different concept 2020-03-18 released |