[latex3-commits] [git/LaTeX3-latex3-latex2e] nfssaxes: fixing an issue that existed in mweights all the time (25ad9386)

Frank Mittelbach frank.mittelbach at latex-project.org
Sat Oct 12 20:04:17 CEST 2019


Repository : https://github.com/latex3/latex2e
On branch  : nfssaxes
Link       : https://github.com/latex3/latex2e/commit/25ad9386ac95d3601c8248b52433f400c7887310

>---------------------------------------------------------------

commit 25ad9386ac95d3601c8248b52433f400c7887310
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Oct 12 20:04:17 2019 +0200

    fixing an issue that existed in mweights all the time


>---------------------------------------------------------------

25ad9386ac95d3601c8248b52433f400c7887310
 base/nfssaxes.tex | 92 +++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 65 insertions(+), 27 deletions(-)

diff --git a/base/nfssaxes.tex b/base/nfssaxes.tex
index f041de60..dae557fa 100644
--- a/base/nfssaxes.tex
+++ b/base/nfssaxes.tex
@@ -1331,6 +1331,15 @@
 %    \begin{macrocode}
   \expand at font@defaults
 %    \end{macrocode}
+%    We have to do the testing while while the current family is still
+%    unchanged but we have to do the adjustment of the series after it
+%    got changed (because the new family might has different sets
+%    ofshapes available and we certainly don't want to see
+%    substituation going on. So we use \cs{target at series@value} to
+%    hold the target series (if any).
+%    \begin{macrocode}
+  \let\target at series@value\@empty
+%    \end{macrocode}
 %    Thus, if the current family is the sans family
 %    \begin{macrocode}
   \ifx\f at family\sfdef at ult
@@ -1341,18 +1350,18 @@
 %    \end{macrocode}
 %    then lets switch to the medium series for the serif family
 %    \begin{macrocode}
-                                       \fontseries\mdseries at rm
+                                       \let\target at series@value\mdseries at rm
 %    \end{macrocode}
 %    and if we use the bold series of the sans family switch to the
 %    bold default of the serif family:
 %    \begin{macrocode}
-       \else\ifx\f at series\bfseries at sf  \fontseries\bfseries at rm
+       \else\ifx\f at series\bfseries at sf  \let\target at series@value\bfseries at rm
 %    \end{macrocode}
 %    However, the sans family may not have any specific defaults set,
 %    so we also compare with the verall defaults.
 %    \begin{macrocode}
-       \else\ifx\f at series\mddef at ult    \fontseries\mdseries at rm
-       \else\ifx\f at series\bfdef at ult    \fontseries\bfseries at rm
+       \else\ifx\f at series\mddef at ult    \let\target at series@value\mdseries at rm
+       \else\ifx\f at series\bfdef at ult    \let\target at series@value\bfseries at rm
 %    \end{macrocode}
 %    If neither test was true we leave the series alone. This way a
 %    special manual setting such as \verb=\fontseries{lc}= is not
@@ -1366,10 +1375,10 @@
 %    We need to do the same if the current family is the typewriter family:
 %    \begin{macrocode}
   \else\ifx\f at family\ttdef at ult
-       \ifx\f at series\mdseries at tt       \fontseries\mdseries at rm
-       \else\ifx\f at series\bfseries at tt  \fontseries\bfseries at rm
-       \else\ifx\f at series\mddef at ult    \fontseries\mdseries at rm
-       \else\ifx\f at series\bfdef at ult    \fontseries\bfseries at rm
+       \ifx\f at series\mdseries at tt       \let\target at series@value\mdseries at rm
+       \else\ifx\f at series\bfseries at tt  \let\target at series@value\bfseries at rm
+       \else\ifx\f at series\mddef at ult    \let\target at series@value\mdseries at rm
+       \else\ifx\f at series\bfdef at ult    \let\target at series@value\bfseries at rm
        \fi\fi\fi\fi
 %    \end{macrocode}
 %    
@@ -1379,7 +1388,24 @@
 %    With these preparations for series out of the way we can now
 %    change the font family to \cs{rmdefault}.
 %    \begin{macrocode}
-  \fontfamily\rmdefault\selectfont}
+  \fontfamily\rmdefault
+%    \end{macrocode}
+%
+%    If \cs{target at series@value} is still empty there is nothing more
+%    to do other than selecting the new family. However, if not then
+%    we should update the font series now as well. But there is one
+%    further subtle issue. We may not have loaded an \textt{.fd} file
+%    for our target font family yet. In the past that was done in
+%    \cs{selectfont} if necessary but since we are now doing all the
+%    comparisons in \cs{fontseries} we need to make sure that the font
+%    family specifications are already loaded prior to calling
+%    \cs{fontseries}.
+%    \begin{macrocode}
+  \ifx\target at series@value\@empty \else
+    \begingroup\try at load@fontshape\endgroup
+    \fontseries\target at series@value
+  \fi
+  \selectfont}
 %    \end{macrocode}
 %    
 %  \begin{macro}{\sffamily}
@@ -1390,40 +1416,52 @@
 \DeclareRobustCommand\sffamily{%
   \not at math@alphabet\sffamily\mathsf
   \expand at font@defaults
+  \let\target at series@value\@empty
   \ifx\f at family\rmdef at ult
-       \ifx\f at series\mdseries at rm       \fontseries\mdseries at sf
-       \else\ifx\f at series\bfseries at rm  \fontseries\bfseries at sf
-       \else\ifx\f at series\mddef at ult    \fontseries\mdseries at sf
-       \else\ifx\f at series\bfdef at ult    \fontseries\bfseries at sf
+       \ifx\f at series\mdseries at rm       \let\target at series@value\mdseries at sf
+       \else\ifx\f at series\bfseries at rm  \let\target at series@value\bfseries at sf
+       \else\ifx\f at series\mddef at ult    \let\target at series@value\mdseries at sf
+       \else\ifx\f at series\bfdef at ult    \let\target at series@value\bfseries at sf
        \fi\fi\fi\fi
   \else\ifx\f at family\ttdef at ult
-       \ifx\f at series\mdseries at tt       \fontseries\mdseries at sf
-       \else\ifx\f at series\bfseries at tt  \fontseries\bfseries at sf
-       \else\ifx\f at series\mddef at ult    \fontseries\mdseries at sf
-       \else\ifx\f at series\bfdef at ult    \fontseries\bfseries at sf
+       \ifx\f at series\mdseries at tt       \let\target at series@value\mdseries at sf
+       \else\ifx\f at series\bfseries at tt  \let\target at series@value\bfseries at sf
+       \else\ifx\f at series\mddef at ult    \let\target at series@value\mdseries at sf
+       \else\ifx\f at series\bfdef at ult    \let\target at series@value\bfseries at sf
        \fi\fi\fi\fi
   \fi\fi
-  \fontfamily\sfdefault\selectfont}
+  \fontfamily\sfdefault
+  \ifx\target at series@value\@empty \else
+    \begingroup\try at load@fontshape\endgroup
+    \fontseries\target at series@value
+  \fi
+  \selectfont}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
 \DeclareRobustCommand\ttfamily{%
   \not at math@alphabet\ttfamily\mathtt
   \expand at font@defaults
+  \let\target at series@value\@empty
   \ifx\f at family\rmdef at ult
-       \ifx\f at series\mdseries at rm       \fontseries\mdseries at tt
-       \else\ifx\f at series\bfseries at rm  \fontseries\bfseries at tt
-       \else\ifx\f at series\mddef at ult    \fontseries\mdseries at tt
-       \else\ifx\f at series\bfdef at ult    \fontseries\bfseries at tt
+       \ifx\f at series\mdseries at rm       \let\target at series@value\mdseries at tt
+       \else\ifx\f at series\bfseries at rm  \let\target at series@value\bfseries at tt
+       \else\ifx\f at series\mddef at ult    \let\target at series@value\mdseries at tt
+       \else\ifx\f at series\bfdef at ult    \let\target at series@value\bfseries at tt
        \fi\fi\fi\fi
   \else\ifx\f at family\rmdef at ult
-       \ifx\f at series\mdseries at rm       \fontseries\mdseries at tt
-       \else\ifx\f at series\bfseries at rm  \fontseries\bfseries at tt
-       \else\ifx\f at series\mddef at ult    \fontseries\mdseries at tt
-       \else\ifx\f at series\bfdef at ult    \fontseries\bfseries at tt
+       \ifx\f at series\mdseries at rm       \let\target at series@value\mdseries at tt
+       \else\ifx\f at series\bfseries at rm  \let\target at series@value\bfseries at tt
+       \else\ifx\f at series\mddef at ult    \let\target at series@value\mdseries at tt
+       \else\ifx\f at series\bfdef at ult    \let\target at series@value\bfseries at tt
        \fi\fi\fi\fi
   \fi\fi
-  \fontfamily\ttdefault\selectfont}
+  \fontfamily\ttdefault
+  \ifx\target at series@value\@empty \else
+    \begingroup\try at load@fontshape\endgroup
+    \fontseries\target at series@value
+  \fi
+  \selectfont}
 %    \end{macrocode}
 %  \end{macro}
 %  \end{macro}





More information about the latex3-commits mailing list