summaryrefslogtreecommitdiff
path: root/macros/optex/base/fonts-select.opm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/optex/base/fonts-select.opm')
-rw-r--r--macros/optex/base/fonts-select.opm38
1 files changed, 25 insertions, 13 deletions
diff --git a/macros/optex/base/fonts-select.opm b/macros/optex/base/fonts-select.opm
index cd70dab03c..d403a490d5 100644
--- a/macros/optex/base/fonts-select.opm
+++ b/macros/optex/base/fonts-select.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \fontfam {Fonts selection system <2023-04-22>} % preloaded in format
+\_codedecl \fontfam {Fonts selection system <2023-06-16>} % preloaded in format
\_doc -----------------------------
The main principle of the Font Selection System is: run one or more
@@ -131,7 +131,7 @@
\_unless\_ifcsname _f:\_csstring#2:main.fam\_endcsname
\_isfont{#7}\_iffalse
\_opwarning{Family [#1] skipped, font "#7" not found}\_endinput
- \_lowercase{\_ifcsname _fams:#1\_endcsname}\_famsubstitute \_fi
+ \_ifcsname _fams:\_famfile\_endcsname \_famsubstitute \_fi
\_else
\_edef\_currfamily {\_csstring #2}\_def\_mathfaminfo{#6}%
\_wterm {FONT: [#1] -- \_string#2 \_detokenize{(#3)^^J mods:{#4} vars:{#5} math:{#6}}}%
@@ -311,12 +311,12 @@
\_protected\_def \_fontfam [#1]{%
\_lowercase{\_edef\_famname{\_ea\_removespaces \_expanded{#1} {} }}%
- \_isfile {f-\_famname.opm}\_iftrue \_opinput {f-\_famname.opm}%
+ \_isfile {f-\_famname.opm}\_iftrue \_edef\_famfile{f-\_famname}\_opinput {f-\_famname.opm}%
\_else
\_tryloadfamslocal
\_edef\_famfile{\_trycs{_famf:\_famname}{}}%
\_ifx\_famfile\_empty
- \_ifcsname _fams:\_famname \_endcsname \_famsubstitute
+ \_ifcsname _fams:f-\_famname \_endcsname \_edef\_famfile{f-\_famname}\_famsubstitute
\_else \_listfamnames
\_fi
\_else \_opinput {\_famfile.opm}%
@@ -352,17 +352,19 @@
family installed.
\`\_famsubstitute` is internal macro used in \^`\fontfam` and \^`\_famdecl` macros.
It consumes the rest of the macro, runs \^`\nospacefuturelet` in order to
- do `\endpinput` to the current `f-file` and runs \^`\fontfam` again.
- The table of such substutitions are saved in the macros `\_fams:<family>`.
+ do `\endinput` to the current `f-file` and runs \^`\fontfam` again.
+ The table of such substutitions are saved in the macros `\_fams:<family-file>`.
\_cod -----------------------------
-\_def \_fontfamsub [#1]#2[#3]{\_lowercase{\_sxdef{_fams:#1}{#3}}}
-
+\_def \_fontfamsub [#1]#2[#3]{\_tryloadfamslocal
+ \_lowercase{\_edef\_tmp{\_removespaces #1 {} }}%
+ \_sxdef{_fams:\_trycs{_famf:\_tmp}{f-\_tmp}}{#3}%
+}
\_def\_famsubstitute #1\_empty\_fi{\_fi\_fi\_fi
- \_wterm {FONT: Family [\_famname] not found, substituted by [\_cs{_fams:\_famname}]}%
+ \_wterm {FONT-SUB: \_famfile\_space -> [\_cs{_fams:\_famfile}]}%
\_nospacefuturelet\_tmp\_famsubstituteA % we want to \endinput current f-file
}
-\_def\_famsubstituteA{\_fontfam[\_cs{_fams:\_famname}]}
+\_def\_famsubstituteA{\_fontfam[\_cs{_fams:\_famfile}]}
\_public \fontfamsub ;
@@ -413,17 +415,19 @@
pairs. The user can declare different samples and different behavior of
the catalog, see the end of catalog listing for more information.
The default parameters
- \`\catalogsample`, \`\catalogmathsample`, \`\catalogonly` and
- \`\catalogexclude` of the catalog are declared here.
+ \`\catalogsample`, \`\catalogmathsample`, \`\catalogonly`,
+ \`\catalogexclude` and \`\catalognextfam` of the catalog are declared here.
\_cod -----------------------------
\_newtoks \_catalogsample
\_newtoks \_catalogmathsample
\_newtoks \_catalogonly
\_newtoks \_catalogexclude
+\_newtoks \_catalognextfam
\_catalogsample={ABCDabcd Qsty fi fl áéíóúüů řžč ÁÉÍÓÚ ŘŽČ 0123456789}
+\_catalognextfam={\_bigskip}
-\_public \catalogonly \catalogexclude \catalogsample \catalogmathsample ;
+\_public \catalogonly \catalogexclude \catalogsample \catalogmathsample \catalognextfam ;
\_doc -----------------------------
The font features are managed in the \`\_fontfeatures` macro.
@@ -587,6 +591,12 @@ described in the section~\ref[fontfamfiles]. Font modifiers and variant
selectors may be declared here.
The loaded family is set as current and `\rm` variant selector is processed.
+When \^`\fontfam` `[<Font Family>]` is used and the given
+family isn't found in the current \TeX/ system and
+the <Font Family> is previously declared by
+\^`\fontfamsub``[<Font Family>][<Other Family>]`
+then \OpTeX/ does the given substitution and runs \^`\fontfam``[<Other Family>]`.
+
The available declared font modifiers and declared variant selectors are
listed in the log file when the font family is load. Or you can print
`\fontfam[catalog]` to show available font modifiers and variant selectors.
@@ -935,6 +945,8 @@ with Unicode fonts loaded by \^`\fontfam`.
\endinput
+2023-06-16 \fontfamsub improved.
+2023-05-30 \catalognextfam introduced.
2023-04-22 \setwordspace: \fontdimens reset, bug fixed.
2023-03-09 \_famsrc, \fontfamsub introduced
2022-12-01 \faminfo saves f-<filename> to the format only when needed