[latex3-commits] [git/LaTeX3-latex3-latex2e] nfssaxes: dropping m's when determining the target series (a0bac60e)
Frank Mittelbach
frank.mittelbach at latex-project.org
Sun Oct 13 17:27:54 CEST 2019
Repository : https://github.com/latex3/latex2e
On branch : nfssaxes
Link : https://github.com/latex3/latex2e/commit/a0bac60e5dfe5d184f99ff1622db020ca2b8f3a7
>---------------------------------------------------------------
commit a0bac60e5dfe5d184f99ff1622db020ca2b8f3a7
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Sun Oct 13 17:27:54 2019 +0200
dropping m's when determining the target series
>---------------------------------------------------------------
a0bac60e5dfe5d184f99ff1622db020ca2b8f3a7
base/nfssaxes.tex | 160 ++++++++++++++++++------------------------------------
1 file changed, 53 insertions(+), 107 deletions(-)
diff --git a/base/nfssaxes.tex b/base/nfssaxes.tex
index 0522248a..66cf4a6d 100644
--- a/base/nfssaxes.tex
+++ b/base/nfssaxes.tex
@@ -51,12 +51,21 @@
%
% \item
%
+% We do support ``\texttt{m}\textit{width}'' and
+% ``\textit{weight}\texttt{m}'', e.g., \texttt{mec} to mean ``go to
+% medium weight and extra-condensed width''. At the end of the
+% process we automatically drop any leftover \texttt{m} in the
+% series name (unless it is just a single \texttt{m}).
+%
+%
+% \item
+%
% If there is no table entry then the target series is used
% unconditionally. This means that any request to set both weight
% and width (e.g. \texttt{bx} or \texttt{ulc}) needs no table
% entries.
-% For that reason there are no entries which have a weight+width
-% request (as second argument).
+% For that reason there are no entries which have a weight+width as
+% request (i.e., second argument).
%
% \item
%
@@ -75,8 +84,8 @@
%
% Also: while I did set up all nine standard weight values from
% \texttt{ul} to \textt{ub} I only bothered to provide entries for
-% \texttt{c} and \texttt{x}, because other levels of
-% compression/expansion are really really seldom.
+% \texttt{ec}, \texttt{sc}, \texttt{c} and \texttt{x}, because other levels of
+% compression/expansion are not in any real fonts that I know.
%
% Could and perhaps should be eventually extended to cover the
% whole set.
@@ -449,6 +458,12 @@
\DeclareFontSeriesChangeRule {x}{ul}{ulx}{}
% \end{macrocode}
%
+%
+% Special rules for \texttt{lm} etc.\ aren't needed because the
+% target{lm} is used which is reduced to \texttt{l}
+% automatically. Same for \texttt{mc} and friends. Only \texttt{?m}
+% and \texttt{m?} need rules.
+%
% Special rules for \texttt{m?}:
% \begin{macrocode}
\DeclareFontSeriesChangeRule {bc}{m?}{c}{}
@@ -556,105 +571,6 @@
\DeclareFontSeriesChangeRule {x}{?m}{m}{}
% \end{macrocode}
%
-% Special rules for \texttt{mc}:
-% \begin{macrocode}
-\DeclareFontSeriesChangeRule {bce}{mc}{c}{}
-\DeclareFontSeriesChangeRule {bc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {bsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {bx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {b}{mc}{c}{}
-\DeclareFontSeriesChangeRule {c}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ebc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ebec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ebsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ebsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ebx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {eb}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {elc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {elec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {elsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {elx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {el}{mc}{c}{}
-\DeclareFontSeriesChangeRule {lc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {lec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {lsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {lx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {l}{mc}{c}{}
-\DeclareFontSeriesChangeRule {m}{mc}{c}{}
-\DeclareFontSeriesChangeRule {sbc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {sbec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {sbsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {sbx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {sb}{mc}{c}{}
-\DeclareFontSeriesChangeRule {sc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {slc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {slec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {slsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {slx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {sl}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ubc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ubec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ubsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ubx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ub}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ulc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ulec}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ulsc}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ulx}{mc}{c}{}
-\DeclareFontSeriesChangeRule {ul}{mc}{c}{}
-\DeclareFontSeriesChangeRule {x}{mc}{c}{}
-% \end{macrocode}
-%
-%
-% Special rules for \texttt{mec}:
-% \begin{macrocode}
-\DeclareFontSeriesChangeRule {bce}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {bc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {bsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {bx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {b}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {c}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ebc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ebec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ebsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ebx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {eb}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {elc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {elec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {elsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {elx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {el}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {lc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {lec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {lsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {lx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {l}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {m}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {sbc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {sbec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {sbsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {sbx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {sb}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {sc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {slc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {slec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {slsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {slx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {sl}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ubc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ubec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ubsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ubx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ub}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ulc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ulec}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ulsc}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ulx}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {ul}{mec}{ec}{}
-\DeclareFontSeriesChangeRule {x}{mec}{ec}{}
-% \end{macrocode}
%
% \emph{rules need to get completed/verified!}
%
@@ -707,7 +623,7 @@
% \begin{macrocode}
\def\@reserveda{#3}%
\ifx\@reserveda\@empty
- \edef\f at series{#2}%
+ \set at target@series{#2}%
\else
% \end{macrocode}
% Otherwise we check if the desired result for the series
@@ -718,7 +634,7 @@
% \end{macrocode}
% If the desired result is available then we use that:
% \begin{macrocode}
- \edef\f at series{#1}%
+ \set at target@series{#1}%
% \end{macrocode}
% If not, then we try the alternate result (\texttt{\#2}).
% \begin{macrocode}
@@ -729,14 +645,14 @@
% warning (or rather a log entry) that we didn't managed to change
% to the desired font.
% \begin{macrocode}
- \edef\f at series{#2}%
+ \set at target@series{#2}%
\@font at shape@subst at warning
% \end{macrocode}
% If that doesn't exist either, then we use the requested series unmodified
% (again with a warning).
% \begin{macrocode}
\else
- \edef\f at series{#3}%
+ \set at target@series{#3}%
\@font at shape@subst at warning
\fi
\fi
@@ -760,6 +676,36 @@
% \end{macro}
+% \begin{macro}{\set at target@series}
+% \begin{macro}{\series at drop@one at m}
+% The combined series value determined by the mapping may still
+% contain an \texttt{m} that we have to remove (as the \texttt{.fd}
+% files use \texttt{c} not \texttt{mc} to denote a medium weight
+% condensed series. We do this in all branches above because a user
+% might have written
+%\begin{verbatim}
+\DeclareFontSeriesChangeRule {m}{sc}{msc}{mc}
+%\end{verbatim}
+% instead of of using \texttt{sc} and \textt{c} as needed in the
+% \textt{.fd} file.
+% \begin{macrocode}
+\def\set at target@series#1{%
+% \end{macrocode}
+% We need to \cs{edef} the argument first in case it starts with a
+% conditional.
+% \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}%
+}
+% \end{macrocode}
+% Drop up to two \texttt{m}s but keep one if that makes the series
+% value empty.
+% \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
+}
+% \end{macrocode}
+% \end{macro}
% \section{Changing the shape}
More information about the latex3-commits
mailing list