[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh293: suggested fix for #293; test file + documentation (894cb140)
Frank Mittelbach
frank.mittelbach at latex-project.org
Thu Feb 27 14:19:51 CET 2020
Repository : https://github.com/latex3/latex2e
On branch : hotfix/gh293
Link : https://github.com/latex3/latex2e/commit/894cb1405c95d4163bdbd8857da0356a09ede334
>---------------------------------------------------------------
commit 894cb1405c95d4163bdbd8857da0356a09ede334
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Thu Feb 27 14:19:51 2020 +0100
suggested fix for #293; test file + documentation
>---------------------------------------------------------------
894cb1405c95d4163bdbd8857da0356a09ede334
base/changes.txt | 18 ++++++++
base/doc/fntguide.tex | 18 +++++++-
base/doc/latexchanges.tex | 12 +++++
base/ltdefns.dtx | 6 ++-
base/ltfssaxes.dtx | 29 ++++++++++--
base/ltfssbas.dtx | 27 +++++++----
base/testfiles-search/github-0293.lvt | 45 +++++++++++++++++++
base/testfiles-search/github-0293.tlg | 84 +++++++++++++++++++++++++++++++++++
8 files changed, 224 insertions(+), 15 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 002ffef1..dd5403d2 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -8,6 +8,24 @@ are not part of the distribution.
#########################
+# 2020-02-02 PL 5 Release
+#########################
+
+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
+ 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)
+
+ * ltdefns.dtx (subsection{Command definitions}):
+ Added \@gobblethree
+
+#########################
# 2020-02-02 PL 4 Release
#########################
diff --git a/base/doc/fntguide.tex b/base/doc/fntguide.tex
index f19e0de7..0fa3698a 100644
--- a/base/doc/fntguide.tex
+++ b/base/doc/fntguide.tex
@@ -229,7 +229,7 @@ ones are:
\end{tabular}
\end{minipage}
\end{center}
-\NEWdescription{2019/07/10}
+\NEWdescription{2019/07/10}\label{page:seriesvalues}
The font series is denoting a combination of the weight (boldness) and
the width (amount of expansion). The standard supported for weights and
widths are:
@@ -1090,6 +1090,22 @@ contain:
This enables the use of an alternative |\hyphenchar| in other encodings
whilst maintaining the correct value for all fonts.
+\NEWfeature{2020/02/02}
+According to NFSS conventions the series value should be a combination
+of weight and width abbreviated each with one or two letters as
+described on page~\pageref{page:seriesvalues}. In particular it should
+not contain contain an ``\texttt{m}'' unless it consists of just one
+character. In the past incorrect values such as ``\texttt{cm}'' or
+``\texttt{mb}'' were simply accepted, but since this now leads to
+problems with the extended mechanism, the correct syntax is now
+enforced. More exactly, if the series values consists of three or less
+characters, it is assumed to be in NFSS notation and if incorrect, a
+warning is given and a surplus ``\texttt{m}'' is dropped. Longer values
+are not touched to allow for the usage of values like
+``\texttt{semibold}'' or ``\texttt{medium}'' as used by the
+\texttt{autoinst} program.
+
+
\subsection{Font file loading information}
\label{sec:loadinfo}
diff --git a/base/doc/latexchanges.tex b/base/doc/latexchanges.tex
index 1442ca22..85b70317 100644
--- a/base/doc/latexchanges.tex
+++ b/base/doc/latexchanges.tex
@@ -107,6 +107,18 @@ see for example
+\section{Changes introduced in 2020-02-02 patch~5}
+
+The patch~4 dropped a bit too much in certain situations, e.g., it
+changed a series value of \texttt{semibold} (as used by
+\texttt{autoinst}) to \texttt{seibold}, rendering it useless. So we
+now only correct series values if they have three or less characters
+assuming that in that case they follow or rather intended to follow
+the NFSS convention. We also add a warning that the
+\verb=\DeclareFontShape= should be updated in if we make a change to
+it (\ghissue{293}).
+
+
\section{Changes introduced in 2020-02-02 patch~4}
In some cases the \texttt{filecontents} environment was opening the
diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index ae472966..303b9e56 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltdefns.dtx}
- [2019/08/27 v1.5f LaTeX Kernel (definition commands)]
+ [2020/02/27 v1.5g LaTeX Kernel (definition commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltdefns.dtx}
@@ -888,17 +888,21 @@
%
% \begin{macro}{\@gobble}
% \begin{macro}{\@gobbletwo}
+% \begin{macro}{\@gobblethree}
+% \changes{v1.5g}{2020/02/27}{Macro added}
% \begin{macro}{\@gobblefour}
% \changes{v1.2n}{1995/05/26}{(CAR) Added \cs{long}s}
% The |\@gobble| macro is used to get rid of its argument.
% \begin{macrocode}
\long\def \@gobble #1{}
\long\def \@gobbletwo #1#2{}
+\long\def \@gobblethree #1#2#3{}
\long\def \@gobblefour #1#2#3#4{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@firstofone}
% \begin{macro}{\@firstoftwo}
diff --git a/base/ltfssaxes.dtx b/base/ltfssaxes.dtx
index 1a8dbd9c..9f473905 100644
--- a/base/ltfssaxes.dtx
+++ b/base/ltfssaxes.dtx
@@ -35,7 +35,7 @@
%
%
\ProvidesFile{ltfssaxes.dtx}
- [2020/02/18 v1.0c LaTeX Kernel (NFSS Axes handing)]
+ [2020/02/27 v1.0d LaTeX Kernel (NFSS Axes handing)]
% \iffalse
\documentclass{ltxdoc}
\begin{document}
@@ -827,7 +827,6 @@
%
%
% \begin{macro}{\set at target@series}
-% \begin{macro}{\series at drop@one at m}
%
% Finally the code for normalizing the \cs{f at series} value.
%
@@ -846,11 +845,33 @@
% \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)}
% \begin{macrocode}
\edef\f at series{#1}%
- \edef\f at series{\expandafter\series at drop@one at m\f at series mm\series at drop@one at m}%
+ \edef\f at series{\expandafter\series at maybe@drop at one@m\expandafter{\f at series}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\series at maybe@drop at one@m}
+% If the series value is in NFSS notation then it should not
+% 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
}
% \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.
% \begin{macrocode}
@@ -859,7 +880,6 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
@@ -1215,6 +1235,7 @@
%<latexrelease>\let\@font at shape@subst at warning\@undefined
%<latexrelease>\let\maybe at load@fontshape\@undefined
%<latexrelease>\let\set at target@series\@undefined
+%<latexrelease>\let\series at maybe@drop at one@m\@undefined
%<latexrelease>\let\series at drop@one at m\@undefined
%<latexrelease>\let\DeclareFontShapeChangeRule\@undefined
%<latexrelease>\let\merge at font@shape\@undefined
diff --git a/base/ltfssbas.dtx b/base/ltfssbas.dtx
index fedfcb68..40af2bae 100644
--- a/base/ltfssbas.dtx
+++ b/base/ltfssbas.dtx
@@ -35,7 +35,7 @@
%
%
\ProvidesFile{ltfssbas.dtx}
- [2020/02/24 v3.2f LaTeX Kernel (NFSS Basic Macros)]
+ [2020/02/27 v3.2g LaTeX Kernel (NFSS Basic Macros)]
% \iffalse
\documentclass{ltxdoc}
\begin{document}
@@ -266,18 +266,27 @@
\expandafter\ifx\csname #1+#2\endcsname\relax
\@latex at error{Font family `#1+#2' unknown}\@eha
\else
- \expandafter
- \xdef\csname#1/#2/%
% \end{macrocode}
% If the series value is incorrectly specified with an extra ``m'',
% e.g., ``mc'' instead of just ``c'', drop the surplus ``m'' but
-% keep the ``m'' if it is by its own.
-% \changes{v3.2f}{2020/12/24}{Drop surplus ``m'' in series when
+% keep the ``m'' if it is by its own. In that case also issue a
+% warning that the declaration needs correction.
+% \changes{v3.2f}{2020/02/24}{Drop surplus ``m'' in series when
% defining fontshape (gh/289)}
-% \begin{macrocode}
- \expandafter\series at drop@one at m #3mm\series at drop@one at m/%
- #4\endcsname{\expandafter\noexpand
- \csname #5\endcsname}%
+% \changes{v3.2g}{2020/02/27}{Only drop ``m'' if there are 3 or less
+% chars and issue warning if doing it (gh/293)}
+% \begin{macrocode}
+ \edef\reserved at a{#3}%
+ \edef\reserved at b{\expandafter\series at maybe@drop at one@m\expandafter{#3}}%
+ \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'!
+ Please correct it.\MessageBreak Found}%
+ \fi
+ \expandafter
+ \xdef\csname#1/#2/\reserved at b/#4\endcsname
+ {\expandafter\noexpand\csname #5\endcsname}%
+%
\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
new file mode 100644
index 00000000..1b029395
--- /dev/null
+++ b/base/testfiles-search/github-0293.lvt
@@ -0,0 +1,45 @@
+\documentclass{article}
+
+\input{test2e}
+
+
+
+\makeatletter
+\def\showfont#1{\typeout{#1: \f at encoding/\f at family/\f at series/\f at shape} ABC\par}
+\makeatother
+
+\showoutput
+
+\START
+
+% some fake mapping
+\LoadFontDefinitionFile{OT1}{lmr}
+\DeclareFontShape{OT1}{lmr}{semibold}{n}{<-> rm-lmb10}{}
+
+\DeclareFontShape{OT1}{lmr}{sb}{n}
+ {<->alias * lmr/semibold/n}{}
+
+\DeclareFontShape{OT1}{lmr}{cm}{n}
+ {<->alias * lmr/m/it}{} % just to see it better
+
+\OMIT
+\begin{document}
+\TIMO
+
+\fontfamily{lmr}\selectfont
+\showfont{1}
+
+\fontseries{semibold}\selectfont
+\showfont{2}
+
+\fontseries{sb}\selectfont
+\showfont{3}
+
+\fontseries{cm}\selectfont
+\showfont{4}
+
+\fontseries{c}\selectfont
+\showfont{5}
+
+
+\end{document}
diff --git a/base/testfiles-search/github-0293.tlg b/base/testfiles-search/github-0293.tlg
new file mode 100644
index 00000000..f490677a
--- /dev/null
+++ b/base/testfiles-search/github-0293.tlg
@@ -0,0 +1,84 @@
+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'.
+ It should not contain an `m'! Please correct it.
+ Found on input line ....
+1: OT1/lmr/m/n
+2: OT1/lmr/semibold/n
+LaTeX Font Info: Font shape `OT1/lmr/sb/n' aliased to
+(Font) `OT1/lmr/semibold/n' on input line ....
+3: OT1/lmr/sb/n
+LaTeX Font Info: Font shape `OT1/lmr/c/n' aliased to
+(Font) `OT1/lmr/m/it' on input line ....
+4: OT1/lmr/c/n
+5: OT1/lmr/c/n
+Completed box being shipped out [1]
+\vbox(633.0+0.0)x407.0
+.\glue 16.0
+.\vbox(617.0+0.0)x345.0, shifted 62.0
+..\vbox(12.0+0.0)x345.0, glue set 12.0fil
+...\glue 0.0 plus 1.0fil
+...\hbox(0.0+0.0)x345.0
+..\glue 25.0
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil
+...\write-{}
+...\glue(\topskip) 3.11125
+...\hbox(6.88875+0.0)x345.0, glue set 308.195fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/lmr/m/n/10 A
+....\OT1/lmr/m/n/10 B
+....\OT1/lmr/m/n/10 C
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 5.13277
+...\hbox(6.86723+0.0)x345.0, glue set 308.11153fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/lmr/semibold/n/10 A
+....\OT1/lmr/semibold/n/10 B
+....\OT1/lmr/semibold/n/10 C
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 5.13277
+...\hbox(6.86723+0.0)x345.0, glue set 308.11153fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/lmr/semibold/n/10 A
+....\OT1/lmr/semibold/n/10 B
+....\OT1/lmr/semibold/n/10 C
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 5.11125
+...\hbox(6.88875+0.0)x345.0, glue set 308.37201fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/lmr/m/it/10 A
+....\OT1/lmr/m/it/10 B
+....\OT1/lmr/m/it/10 C
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 5.11125
+...\hbox(6.88875+0.0)x345.0, glue set 308.37201fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/lmr/m/it/10 A
+....\OT1/lmr/m/it/10 B
+....\OT1/lmr/m/it/10 C
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+...\glue 0.0 plus 0.0001fil
+..\glue(\baselineskip) 23.55556
+..\hbox(6.44444+0.0)x345.0, glue set 170.0fil
+...\glue 0.0 plus 1.0fil
+...\OT1/cmr/m/n/10 1
+...\glue 0.0 plus 1.0fil
+(github-0293.aux)
More information about the latex3-commits
mailing list.