diff options
Diffstat (limited to 'macros/latex/base/ltfssaxes.dtx')
-rw-r--r-- | macros/latex/base/ltfssaxes.dtx | 402 |
1 files changed, 334 insertions, 68 deletions
diff --git a/macros/latex/base/ltfssaxes.dtx b/macros/latex/base/ltfssaxes.dtx index a66a26cd39..86c84b111f 100644 --- a/macros/latex/base/ltfssaxes.dtx +++ b/macros/latex/base/ltfssaxes.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % -% Copyright (C) 2019-2020 -% The LaTeX3 Project and any individual authors listed elsewhere +% Copyright (C) 2019-2021 +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -35,7 +35,7 @@ % % \ProvidesFile{ltfssaxes.dtx} - [2020/08/21 v1.0g LaTeX Kernel (NFSS Axes handing)] + [2021/03/18 v1.0i LaTeX Kernel (NFSS Axes handing)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -68,11 +68,11 @@ % % \StopEventually{} % -% Everything in the this file got introduced 2020/02/02, so we do a -% single rollback (for now). +% \changes{v1.0h}{2020/12/04}{Reorganized the rollback data} +% +% Everything in the this file got introduced 2020/02/02, so we use large rollback +% chunks, only interrupted if necessary. % \begin{macrocode} -%<*2ekernel> -%</2ekernel> %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2020/02/02}% %<latexrelease> {\DeclareFontSeriesChangeRule}{Series change rules}% @@ -168,13 +168,13 @@ % request (i.e., second argument). % % In particular this is also true for cases involving \texttt{m}, -% e.g., \texttt{bm} (bold medium width) which automatially gets +% e.g., \texttt{bm} (bold medium width) which automatically gets % reduced result in \texttt{b} or \texttt{mc} (medium weight % condensed) which becomes \texttt{c} as a result. % % \item % -% Only a few entries have ``alterative'' values and perhaps most of +% Only a few entries have ``alternative'' values and perhaps most of % them should get dropped. Or maybe not \ldots{} needs some thought % perhaps. % @@ -183,7 +183,7 @@ % to stay with \texttt{b} when a change to \texttt{c} is requested % and \texttt{bc} doesn't exist, than to go to first change the % shape to \texttt{n} and then find that \texttt{bc/n} doesn't -% exist either and thus ending up wth \texttt{m/n}. +% exist either and thus ending up with \texttt{m/n}. % % \item % @@ -678,21 +678,59 @@ % \end{macrocode} % % - - +% Supporting rollback \ldots +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\DeclareFontSeriesChangeRule}{Series change rules}% +%<latexrelease> +%<latexrelease>\let\DeclareFontSeriesChangeRule\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% +% +% +% % \subsection{Changing to a new series} % % - -% \begin{macro}{\if@forced@series} -% If the series gets forced we need to know that fact later on. +% \begin{macrocode} +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/06/01}% +%<latexrelease> {\fontseries}{delay fontseries update}% +% \end{macrocode} +% +% +% \begin{macro}{\fontseries} +% The \cs{fontseries} command takes one argument which is the requested new +% font series. In the orginal implementation it simply saved the +% expanded value in \cs{f@series}. Now we do a bit more processing +% and look up the final value in the font series data base. This is +% done by \cs{merge@font@series}. But the lookup should be done +% within the target family and call to \cs{fontseries} might be +% followed by a \cs{fontfamily} call. So we delay the processing to +% \cs{selectfont} and only record the necessary action in +% \cs{delayed@f@adjustment}. % \changes{v1.0c}{2020/02/10}{Switch \cs{if@forced@series} added} +% \changes{v1.0h}{2020/12/04}{Distangle series and shape update (gh/444)} % \begin{macrocode} -\newif\if@forced@series +\DeclareRobustCommand\fontseries[1]{\@forced@seriesfalse + \expandafter\def\expandafter\delayed@f@adjustment\expandafter + {\delayed@f@adjustment\delayed@merge@font@series{#1}}} % \end{macrocode} % \end{macro} % % +% \begin{macro}{\delayed@f@adjustment} +% The macro holding the delayed action(s) for use in \cs{selectfont}. +% \begin{macrocode} +\let\delayed@f@adjustment\@empty +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\fontseriesforce} % To change unconditionally to a new series you can use % \cs{fontseriesforce}. Of course, if the series doesn't exist for @@ -700,24 +738,69 @@ % dependency on the current series. % \changes{v1.0c}{2020/02/10}{Switch \cs{if@forced@series} added} % \begin{macrocode} -\DeclareRobustCommand\fontseriesforce[1]{\@forced@seriestrue\edef\f@series{#1}} +\DeclareRobustCommand\fontseriesforce[1]{\@forced@seriestrue + \expandafter\def\expandafter\delayed@f@adjustment\expandafter + {\delayed@f@adjustment\edef\f@series{#1}}} % \end{macrocode} % \end{macro} % % -% \begin{macro}{\fontseries} -% The \cs{fontseries} command takes one argument which is the requested new -% font series. In the orginal implementation it simply saved the -% expanded value in \cs{f@series}. Now we do a bit more processing -% and look up the final value in the font series data base. This is -% done by \cs{merge@font@series}. +% +% \begin{macro}{\if@forced@series} +% If the series gets forced we need to know that fact later on. % \changes{v1.0c}{2020/02/10}{Switch \cs{if@forced@series} added} % \begin{macrocode} -\DeclareRobustCommand\fontseries[1]{\@forced@seriesfalse\merge@font@series{#1}} +\newif\if@forced@series % \end{macrocode} % \end{macro} - - +% +% +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{2020/02/02}% +%<latexrelease> {\fontseries}{delay fontseries update}% +%<latexrelease> +%<latexrelease>\DeclareRobustCommand\fontseries[1]{\@forced@seriesfalse +%<latexrelease> \merge@font@series{#1}} +%<latexrelease>\DeclareRobustCommand\fontseriesforce[1]{\@forced@seriestrue +%<latexrelease> \edef\f@series{#1}} +%<latexrelease>\let\delayed@f@adjustment\@undefined +%<latexrelease> +% \end{macrocode} +% For a roll forward we may have to define \cs{if@forced@series} +% but this needs doing in a way that \TeX{} doesn't see it when +% skipping over conditionals. +% \changes{v1.0i}{2021/03/18} +% {Fix rollforward definition.} +% \begin{macrocode} +%<latexrelease>\expandafter\newif\csname if@forced@series\endcsname +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\fontseries}{delay fontseries update}% +%<latexrelease> +%<latexrelease>\DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}} +%<latexrelease>\let\fontseriesforce\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% +% +% \begin{macrocode} +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2020/02/02}% +%<latexrelease> {\merge@font@series}{Merge series values}% +% \end{macrocode} +% +% % \begin{macro}{\merge@font@series} % We look up the data base value by expanding the right command % twice. If no such value exist then the result will be \cs{relax} @@ -734,9 +817,9 @@ } % \end{macrocode} % \end{macro} - - - +% +% +% % \begin{macro}{\merge@font@series@} % This now defines the new \cs{f@series}: % \begin{macrocode} @@ -758,11 +841,9 @@ % \end{macrocode} % Otherwise we check if the desired result for the series % (\texttt{\#1}) exists for the font family and the current shape. -% As the \texttt{.fd} is perhaps not loaded yet, we first -% have to do that, otherwise the test would fail even if the face -% is actually available. +% All this happens inside \cs{selectfont} which has already taken care to load +% the \texttt{.fd}, file if necessary. % \begin{macrocode} - \maybe@load@fontshape \edef\reserved@a{\f@encoding /\f@family /#1/\f@shape}% \ifcsname \reserved@a \endcsname % \end{macrocode} @@ -798,9 +879,10 @@ % \end{macrocode} % It is possible that the previous font and the new one are % actually identical (and the font was not found because it still -% needs loading) in which case a warning would look rather odd. So -% we make a quick check for that (which is the reason why we defined -% \cs{@reserveda} above. +% needs loading) in which case a warning would look rather odd. So +% we make a quick check for that (which is the reason why we +% defined \cs{@reserveda} above instead of doing inline testing +% inside \cs{ifcsname}). % \begin{macrocode} \def\@font@shape@subst@warning{% \edef\reserved@b{\curr@fontshape}% @@ -814,13 +896,71 @@ % % % +% \begin{macro}{\merge@font@series@without@substitution, +% \merge@font@series@without@substitution@, +% \delayed@merge@font@series} +% +% \changes{v1.0h}{2020/12/22}{Distangle series and shape update (gh/444)} +% +% \cs{merge@font@series@without@substitution} works like +% \cs{merge@font@series}, i.e., it looks up the combination in the +% rule base and if there exists an entry it uses it and if not it +% uses the new series value. However, it doesn't check if there is +% actually a font face with the new series value as +% \cs{merge@font@series} does. This simplified command is used in +% \cs{selectfont} at a point where other font attributes are not +% yet updated so that checking the font face might result incorrect +% in substitutions. +% +% \begin{macrocode} +\def\merge@font@series@without@substitution#1{% + \expandafter\expandafter\expandafter + \merge@font@series@without@substitution@ + \csname series@\f@series @#1\endcsname + {#1}% + \@nil +} +% \end{macrocode} +% +% \begin{macrocode} +\def\merge@font@series@without@substitution@#1#2#3\@nil{% + \def\reserved@a{#3}% + \ifx\reserved@a\@empty + \set@target@series{#2}% + \else + \set@target@series{#1}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\delayed@merge@font@series} +% +% When we delay the merge action in \cs{fontseries} we first +% attempt to use merging without substitution. If that results in a +% non-existing font face the merge is redone in \cs{selectfont} +% using a version with substitution. See \cs{selectfont} for details. +% +% \changes{v1.0h}{2020/12/22}{Distangle series and shape update +% (gh/444)} +% \begin{macrocode} +\let\delayed@merge@font@series\merge@font@series@without@substitution +% \end{macrocode} +% \end{macro} % % \begin{macro}{\maybe@load@fontshape} % A small helper that we use a couple of times: try loading a % fontshape (in a group because \cs{try@load@fontshape} normalizes -% catcodes). +% catcodes and we also want to change \cs{typeout} so that it +% doesn't report missing \texttt{.fd} files on the terminal). % \begin{macrocode} -\def\maybe@load@fontshape{\begingroup\try@load@fontshape\endgroup} +\def\maybe@load@fontshape{% + \begingroup + \let \typeout \@font@info + \try@load@fontshape + \endgroup} % \end{macrocode} % \end{macro} % @@ -845,7 +985,7 @@ % \end{macrocode} % We need to \cs{edef} the argument first in case it starts with a % conditional. Then we check (and perhaps drop) an ``m'' from the -% value andassign the result to \cs{f@series}. +% value and assign the result to \cs{f@series}. % \changes{v1.0d}{2020/02/27}{Drop ``m'' only in a specific set of values (gh/293)} % \begin{macrocode} \edef\f@series{#1}% @@ -916,6 +1056,30 @@ } % \end{macrocode} % \end{macro} +% +% +% +% Supporting rollback \ldots +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\merge@font@series}{Merge series values}% +%<latexrelease> +%<latexrelease>\let\merge@font@series\@undefined +%<latexrelease>\let\merge@font@series@\@undefined +%<latexrelease>\let\@font@shape@subst@warning\@undefined +%<latexrelease>\let\merge@font@series@without@substitution\@undefined +%<latexrelease>\let\merge@font@series@without@substitution@\@undefined +%<latexrelease>\let\delayed@merge@font@series\@undefined +%<latexrelease>\let\maybe@load@fontshape\@undefined +%<latexrelease>\let\set@target@series\@undefined +%<latexrelease>\let\series@maybe@drop@one@m\@undefined +%<latexrelease>\let\series@drop@one@m\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} + @@ -925,6 +1089,12 @@ % that is desirable), essentially building in an ``sc'' % axis). % +% \begin{macrocode} +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2020/02/02}% +%<latexrelease> {\DeclareFontShapeChangeRule}{Font shape change rules}% +% \end{macrocode} +% % % % \begin{macro}{\DeclareFontShapeChangeRule} @@ -948,8 +1118,9 @@ % resets everything and \texttt{up} changes italic or slanted to % upright and \texttt{ulc} undoes small caps. % -% So we now offer \cs{normalshape} (using \cs{shapedefault} which is normally the same as -% calling both \cs{ulcshape} and \cs{upshape}, only more efficient. +% So we now offer \cs{normalshape} (using \cs{shapedefault} which +% is normally the same as calling both \cs{ulcshape} and +% \cs{upshape}, only more efficient. % % % \begin{macro}{\ulcshape} @@ -1080,7 +1251,7 @@ % \texttt{n}. This is the way \texttt{fontspec} implemented its % version on this interface, so this rule means we are also % compatible with the way \texttt{fontspec} behaved. Still it -% remains an odditywhic I would rather liked to have avoided. +% remains an oddity which I would rather liked to have avoided. % \begin{macrocode} %\DeclareFontShapeChangeRule {sc}{up} {sc} {} \DeclareFontShapeChangeRule {sc}{up} {n} {} @@ -1100,7 +1271,7 @@ % \texttt{ulc} in \cs{f@series} which most certainly doesn't % exist. So when a font is later selected that would result in a % substitution (so no harm done really). Alternatively, we could in -% this case use \texttt{n} as aternative, which may be a bit +% this case use \texttt{n} as alternative, which may be a bit % faster, but such a setup would be so weird in the first place % that this isn't worth the effort. % @@ -1134,26 +1305,97 @@ \DeclareFontShapeChangeRule {sw}{up} {n} {} % \end{macrocode} % +% Supporting rollback \ldots +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\DeclareFontShapeChangeRule}{Font shape change rules}% +%<latexrelease> +%<latexrelease>\let\DeclareFontShapeChangeRule\@undefined +%<latexrelease>\let\ulcshape\@undefined +%<latexrelease>\let\ulcdefault\@undefined +%<latexrelease>\let\swshape\@undefined +%<latexrelease>\let\swdefault\@undefined +%<latexrelease>\let\sscshape\@undefined +%<latexrelease>\let\sscdefault\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% % % \subsection{Changing to a new shape} % +% +% \begin{macrocode} +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/06/01}% +%<latexrelease> {\fontshape}{Font shape change}% +% \end{macrocode} +% +% +% % \begin{macro}{\fontshape} % Again the \cs{fontshape} now has to do a lookup to get to its new % value in \cs{f@shape}. The method is exactly the same as in % \cs{fontseries}. +% \changes{v1.0h}{2020/12/04}{Distangle series and shape update (gh/444)} % \begin{macrocode} -\DeclareRobustCommand\fontshape[1]{\merge@font@shape{#1}} +\DeclareRobustCommand\fontshape[1] + {\expandafter\def\expandafter\delayed@f@adjustment\expandafter + {\delayed@f@adjustment\delayed@merge@font@shape{#1}}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\fontshapeforce} % The unconditional version: +% +% \changes{v1.0h}{2020/12/04}{Distangle series and shape update (gh/444)} % \begin{macrocode} -\DeclareRobustCommand\fontshapeforce[1]{\edef\f@shape{#1}} +\DeclareRobustCommand\fontshapeforce[1] + {\expandafter\def\expandafter\delayed@f@adjustment\expandafter + {\delayed@f@adjustment\edef\f@shape{#1}}} % \end{macrocode} % \end{macro} % +% +% Supporting rollback \ldots +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{2020/02/02}% +%<latexrelease> {\fontshape}{Font shape change}% +%<latexrelease> +%<latexrelease>\DeclareRobustCommand\fontshape[1]{\merge@font@shape{#1}} +%<latexrelease>\DeclareRobustCommand\fontshapeforce[1]{\edef\f@shape{#1}} +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\fontshape}{Font shape change}% +%<latexrelease> +%<latexrelease>\DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}} +%<latexrelease>\let\fontshapeforce\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% + + + + + +% \begin{macrocode} +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2020/02/02}% +%<latexrelease> {\merge@font@shape}{Font shape change rules}% +% \end{macrocode} +% +% +% % \begin{macro}{\merge@font@shape} % Look up the database entry (if existing) and act accordingly. % \begin{macrocode} @@ -1178,9 +1420,12 @@ \ifx\reserved@a\@empty \edef\f@shape{#2}% \else - \maybe@load@fontshape +% \end{macrocode} +% \cs{reserved@a} is used in \cs{@font@shape@subst@warning} so we +% have to define it in addition to do the \cs{ifcsname} test +% \begin{macrocode} \edef\reserved@a{\f@encoding /\f@family /\f@series/#1}% - \ifcsname \reserved@a\endcsname + \ifcsname \reserved@a\endcsname \edef\f@shape{#1}% \else \ifcsname \f@encoding /\f@family /\f@series/#2\endcsname @@ -1197,6 +1442,38 @@ % \end{macro} % % +% \begin{macro}{\merge@font@shape@without@substitution, +% \merge@font@shape@without@substitution@, +% \delayed@merge@font@shape} +% See definition of \cs{selectfont} for how these macros are used. +% \changes{v1.0h}{2020/12/22}{Distangle series and shape update (gh/444)} +% \begin{macrocode} +\def\merge@font@shape@without@substitution#1{% + \expandafter\expandafter\expandafter + \merge@font@shape@without@substitution@ + \csname shape@\f@shape @#1\endcsname + {#1}% + \@nil +} +% \end{macrocode} +% +% \begin{macrocode} +\def\merge@font@shape@without@substitution@#1#2#3\@nil{% + \def\reserved@a{#3}% + \ifx\reserved@a\@empty + \edef\f@shape{#2}% + \else + \edef\f@shape{#1}% + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\let\delayed@merge@font@shape\merge@font@shape@without@substitution +% \end{macrocode} +% \end{macro} +% +% % % \begin{macro}{\normalshape} % @@ -1255,52 +1532,41 @@ % \end{macrocode} % \end{macro} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Supporting rollback \ldots % \begin{macrocode} %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000/00/00}% -%<latexrelease> {\DeclareFontSeriesChangeRule}{Series change rules}% +%<latexrelease> {\merge@font@shape}{Font shape change rules}% %<latexrelease> -%<latexrelease>\DeclareRobustCommand\fontseries[1]{\edef\f@series{#1}} %<latexrelease>\DeclareRobustCommand\fontshape [1]{\edef\f@shape{#1}} -%<latexrelease>\let\fontseriesforce\@undefined %<latexrelease>\let\fontshapeforce\@undefined %<latexrelease> -%<latexrelease>\let\DeclareFontSeriesChangeRule\@undefined -%<latexrelease>\let\merge@font@series\@undefined -%<latexrelease>\let\merge@font@series@\@undefined -%<latexrelease>\let\@font@shape@subst@warning\@undefined -%<latexrelease>\let\maybe@load@fontshape\@undefined -%<latexrelease>\let\set@target@series\@undefined -%<latexrelease>\let\series@maybe@drop@one@m\@undefined -%<latexrelease>\let\series@drop@one@m\@undefined -%<latexrelease>\let\DeclareFontShapeChangeRule\@undefined %<latexrelease>\let\merge@font@shape\@undefined %<latexrelease>\let\merge@font@shape@\@undefined +%<latexrelease> +%<latexrelease>\let\merge@font@shape@without@substitution\@undefined +%<latexrelease>\let\merge@font@shape@without@substitution@\@undefined +%<latexrelease>\let\delayed@merge@font@shape\@undefined +%<latexrelease> %<latexrelease>\let\normalshape\@undefined -%<latexrelease>\let\ulcshape\@undefined -%<latexrelease>\let\ulcdefault\@undefined -%<latexrelease>\let\swshape\@undefined -%<latexrelease>\let\swdefault\@undefined -%<latexrelease>\let\sscshape\@undefined -%<latexrelease>\let\sscdefault\@undefined -%<latexrelease>\let\normalshape\@undefined +%<latexrelease> % \end{macrocode} % This is always called in \cs{document} so don't make it undefined. % \begin{macrocode} %<latexrelease> %<latexrelease>\let\reinstall@nfss@defs\relax %<latexrelease>\EndIncludeInRelease -%<*2ekernel> % \end{macrocode} % +% +% % This initializes the 2020/02/02 extensions to NFSS after any changes % in the preamble. % \changes{v1.0g}{2020/08/21}{Integration of new hook management interface} % \begin{macrocode} -%</2ekernel> %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2020/10/01}% %<latexrelease> {\reinstall@nfss@defs}{NFSS series init}% |