[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh293: slightly improved version using a fixed set of values to test against rather than always dropping if there are 3 chars or less in the series (910c2c7e)
Frank Mittelbach
frank.mittelbach at latex-project.org
Thu Feb 27 23:26:00 CET 2020
Repository : https://github.com/latex3/latex2e
On branch : hotfix/gh293
Link : https://github.com/latex3/latex2e/commit/910c2c7e84146c02ac9f2c3781149c7f2152c34d
>---------------------------------------------------------------
commit 910c2c7e84146c02ac9f2c3781149c7f2152c34d
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Thu Feb 27 23:26:00 2020 +0100
slightly improved version using a fixed set of values to test against rather than always dropping if there are 3 chars or less in the series
>---------------------------------------------------------------
910c2c7e84146c02ac9f2c3781149c7f2152c34d
base/changes.txt | 8 ++++----
base/ltfssaxes.dtx | 36 +++++++++++++++++++++--------------
base/ltfssbas.dtx | 17 ++++++++++++++---
base/testfiles-search/github-0293.lvt | 4 ++--
base/testfiles-search/github-0293.tlg | 2 +-
5 files changed, 43 insertions(+), 24 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index dd5403d2..ac32b7c7 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -14,13 +14,13 @@ are not part of the distribution.
2020-02-27 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
* ltfssaxes.dtx (subsection{Changing to a new series}):
- Drop ``m'' only if 3 or less chars otherwise assume that the series
+ Drop ``m'' in a fixed set of series values,
+ otherwise assume that the series
value is a long name such as "semibold" and leave it alone (gh/293)}
-
* ltfssbas.dtx (section{Macros for setting up the tables}):
- Only drop ``m'' from series value in \DeclareFontShape if
- there are 3 or less chars and issue warning if doing it (gh/293)
+ Drop one ``m'' in the series values in \DeclareFontShape if it is
+ on of a fixed sets of values and if so issue warning (gh/293)
* ltdefns.dtx (subsection{Command definitions}):
Added \@gobblethree
diff --git a/base/ltfssaxes.dtx b/base/ltfssaxes.dtx
index 9f473905..538caf53 100644
--- a/base/ltfssaxes.dtx
+++ b/base/ltfssaxes.dtx
@@ -844,11 +844,12 @@
\def\set at target@series#1{%
% \end{macrocode}
% We need to \cs{edef} the argument first in case it starts with a
-% conditional.
-% \changes{v1.0d}{2020/02/27}{Drop ``m'' only if 3 or less chars (gh/293)}
+% conditional. Then we check (and perhaps drop) an ``m'' from the
+% value andassign the result to \cs{f at series}.
+% \changes{v1.0d}{2020/02/27}{Drop ``m'' only in a specific set of values (gh/293)}
% \begin{macrocode}
\edef\f at series{#1}%
- \edef\f at series{\expandafter\series at maybe@drop at one@m\expandafter{\f at series}}%
+ \expandafter\series at maybe@drop at one@m\expandafter{\f at series}\f at series
}
% \end{macrocode}
% \end{macro}
@@ -858,25 +859,32 @@
% contain any ``m'' unless it is just an ``m'' by it own. So we
% need to drop surplus ``m''s. But we better don't do this for full
% names, such as ``\texttt{semibold}'' as used by
-% \texttt{autoinst}, for example. So we test if the values has at
-% most 3 characters and only then drop any ``m''.
-% \changes{v1.0d}{2020/02/27}{Drop ``m'' only if 3 or less chars (gh/293)}
-% \begin{macrocode}
-\def\series at maybe@drop at one@m#1{%
- \expandafter
- \ifx\expandafter\@empty\@gobblethree#1\@empty\@empty\@empty\@empty
- \expandafter\series at drop@one at m #1mm\series at drop@one at m
- \else #1\fi
+% \texttt{autoinst}, for example. So we test against the possible
+% explicit values that should drop an ``m''.
+% After that we assign the result to \verb=#2= for further use.
+% \changes{v1.0d}{2020/02/27}{Drop ``m'' in certain values from a
+% fixed list (gh/293)}
+% \begin{macrocode}
+\def\series at maybe@drop at one@m#1#2{%
+ \in@{,#1,}%
+ {,ulm,elm,lm,slm,mm,sbm,bm,ebm,ubm,muc,mec,mc,msc,msx,mx,mex,mux,}%
+ \ifin@
+ \edef#2{\expandafter\series at drop@one at m #1m\series at drop@one at m}%
+ \else \def#2{#1}\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\series at drop@one at m}
% Drop up to two \texttt{m}s but keep one if that makes the series
-% value empty.
+% value empty. Actually, with the current implementation we know
+% that there is at least one in the series value istelf and we
+% added one after it, so all we have to do is now returning
+% \verb=#1#2= and dropping the rest.
% \begin{macrocode}
\def\series at drop@one at m#1m#2m#3\series at drop@one at m{%
- \ifx\relax#1#2\relax m\else#1#2\fi
+% \ifx\relax#1#2\relax m\else#1#2\fi
+ #1#2%
}
% \end{macrocode}
% \end{macro}
diff --git a/base/ltfssbas.dtx b/base/ltfssbas.dtx
index 40af2bae..f51d742d 100644
--- a/base/ltfssbas.dtx
+++ b/base/ltfssbas.dtx
@@ -273,11 +273,16 @@
% warning that the declaration needs correction.
% \changes{v3.2f}{2020/02/24}{Drop surplus ``m'' in series when
% defining fontshape (gh/289)}
-% \changes{v3.2g}{2020/02/27}{Only drop ``m'' if there are 3 or less
-% chars and issue warning if doing it (gh/293)}
+% \changes{v3.2g}{2020/02/27}{Only ``m'' if the series value is a member
+% of a fixed list and issue warning if doing it (gh/293)}
+%
+% For this we compare the given value \verb=#3= with one where we
+% may have dropped an ``m''. If nothing has changes,
+% fine. Otherwise there was a wrong value which is now corrected in
+% \cs{reservedb} so we use that and also issue a warning.
% \begin{macrocode}
\edef\reserved at a{#3}%
- \edef\reserved at b{\expandafter\series at maybe@drop at one@m\expandafter{#3}}%
+ \expandafter\series at maybe@drop at one@m\expandafter{#3}\reserved at b
\ifx\reserved at a\reserved at b\else
\@latex at warning{Font shape declaration has incorrect series
value `#3'.\MessageBreak It should not contain an `m'!
@@ -287,6 +292,12 @@
\xdef\csname#1/#2/\reserved at b/#4\endcsname
{\expandafter\noexpand\csname #5\endcsname}%
%
+% \end{macrocode}
+% Most of the time \verb=#6= is empty so using \cs{let} to
+% \cs{@empty} saves on space compared to using \cs{def}. That's
+% really one of the old space saving techniques and probably not
+% necessary these days.
+% \begin{macrocode}
\def\reserved at a{#6}%
\global
\expandafter\let\csname#5\expandafter\endcsname
diff --git a/base/testfiles-search/github-0293.lvt b/base/testfiles-search/github-0293.lvt
index 1b029395..902ad2ec 100644
--- a/base/testfiles-search/github-0293.lvt
+++ b/base/testfiles-search/github-0293.lvt
@@ -19,7 +19,7 @@
\DeclareFontShape{OT1}{lmr}{sb}{n}
{<->alias * lmr/semibold/n}{}
-\DeclareFontShape{OT1}{lmr}{cm}{n}
+\DeclareFontShape{OT1}{lmr}{mc}{n}
{<->alias * lmr/m/it}{} % just to see it better
\OMIT
@@ -35,7 +35,7 @@
\fontseries{sb}\selectfont
\showfont{3}
-\fontseries{cm}\selectfont
+\fontseries{mc}\selectfont
\showfont{4}
\fontseries{c}\selectfont
diff --git a/base/testfiles-search/github-0293.tlg b/base/testfiles-search/github-0293.tlg
index f490677a..7120c5a4 100644
--- a/base/testfiles-search/github-0293.tlg
+++ b/base/testfiles-search/github-0293.tlg
@@ -1,7 +1,7 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
LaTeX Font Info: Trying to load font information for OT1+lmr on input line ....
-LaTeX Warning: Font shape declaration has incorrect series value `cm'.
+LaTeX Warning: Font shape declaration has incorrect series value `mc'.
It should not contain an `m'! Please correct it.
Found on input line ....
1: OT1/lmr/m/n
More information about the latex3-commits
mailing list.