[latex3-commits] [git/LaTeX3-latex3-latex2e] nfssaxes: initial code for nfss axes (a78ac53d)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Oct 7 02:23:27 CEST 2019


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

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

commit a78ac53d88cadec5d811d6c21462bbcc69801a6d
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Oct 7 02:23:27 2019 +0200

    initial code for nfss axes


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

a78ac53d88cadec5d811d6c21462bbcc69801a6d
 base/build.lua                      |   2 +
 base/cmfonts.fdd                    |   3 +
 base/ltfinal.dtx                    |   8 +
 base/ltvers.dtx                     |   2 +-
 base/nfssaxes.tex                   | 518 ++++++++++++++++++++++++++++++++++++
 base/testfiles/tlb-nfssaxes-001.lvt | 104 ++++++++
 base/testfiles/tlb-nfssaxes-001.tlg |  34 +++
 base/testfiles/tlb-nfssaxes-002.lvt |  61 +++++
 base/testfiles/tlb-nfssaxes-002.tlg |  27 ++
 base/testfiles/tlb1214.tlg          |   4 +-
 base/testfiles/tnfss3.tlg           |   5 +-
 11 files changed, 761 insertions(+), 7 deletions(-)

diff --git a/base/build.lua b/base/build.lua
index 8cf4079c..f4c5de39 100644
--- a/base/build.lua
+++ b/base/build.lua
@@ -36,6 +36,7 @@ installfiles   =
     "sample2e.tex",
     "small2e.tex",
     "testpage.tex",
+    "nfssaxes.tex",
   }
 sourcefiles    =
   {
@@ -51,6 +52,7 @@ sourcefiles    =
     "sample2e.tex",
     "small2e.tex",
     "testpage.tex",
+    "nfssaxes.tex",
   }
 textfiles =
   {
diff --git a/base/cmfonts.fdd b/base/cmfonts.fdd
index f3303947..00aa2ed6 100644
--- a/base/cmfonts.fdd
+++ b/base/cmfonts.fdd
@@ -1021,6 +1021,9 @@
 %<+Ucmtt>\DeclareFontShape{U}{cmtt}{bx}{it}%
 %<-nowarn>  {<->sub*cmtt/m/it}{}
 %<+nowarn>  {<->ssub*cmtt/m/it}{}
+%<+OT1cmtt>\DeclareFontShape{OT1}{cmtt}{bx}{sl}
+%<-nowarn>  {<->sub*cmtt/m/n}{}
+%<+nowarn>  {<->ssub*cmtt/m/n}{}
 %<+OT1cmtt>\DeclareFontShape{OT1}{cmtt}{bx}{ui}
 %<+Ucmtt>\DeclareFontShape{U}{cmtt}{bx}{ui}%
 %<-nowarn>  {<->sub*cmtt/m/it}{}
diff --git a/base/ltfinal.dtx b/base/ltfinal.dtx
index 47641e96..62813059 100644
--- a/base/ltfinal.dtx
+++ b/base/ltfinal.dtx
@@ -1116,6 +1116,14 @@
 % \end{macro}
 % \end{macro}
 %
+% \subsection{Do some temporary work for pre-release}
+%
+%    This is a good place to load code that hasn't yet been
+%    integrated into the other files \ldots
+%    \begin{macrocode}
+\input nfssaxes.tex
+%    \end{macrocode}
+%
 % \subsection{Dumping the format}
 %    Finally we make |@| into a letter, ensure the format will
 % be in the `normal' error mode, and dump everything into the
diff --git a/base/ltvers.dtx b/base/ltvers.dtx
index 24838e9c..85e81411 100644
--- a/base/ltvers.dtx
+++ b/base/ltvers.dtx
@@ -125,7 +125,7 @@
 %    intended to help help us internally when we locally install a
 %    format out of some development branch.
 %    \begin{macrocode}
-\edef\development at branch@name{development \the\year-\the\month-\the\day}
+\edef\development at branch@name{nfssaxes \the\year-\the\month-\the\day}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
diff --git a/base/nfssaxes.tex b/base/nfssaxes.tex
new file mode 100644
index 00000000..a747f6fd
--- /dev/null
+++ b/base/nfssaxes.tex
@@ -0,0 +1,518 @@
+
+% \section{Changing the font series}
+%
+% \emph{write intro}
+%
+%  \begin{macro}{\DeclareFontSeriesChangeRule}
+%    The \cs{DeclareFontSeriesChangeRule} defines entries in a simple
+%    database (implemented as a set of commands) that define mappings
+%    between from an existing series and requested new series and maps
+%    that to  a result series (and additionally offers an alternative
+%    if the desired one is not existing):
+%    \begin{itemize}
+%    \item[\texttt{\#1}] current \cs{f at series}
+%    \item[\texttt{\#2}] requested new series
+%    \item[\texttt{\#3}] result (if that exist for the given font family
+%    \item[\texttt{\#4}] alternative result (if \textt{\#3} does not exist)
+%    \end{itemize}
+%    If an \texttt{.fd} file has its own substitution rules then
+%    \texttt{\#3} exist and thus \textt{\#4} is not applied.
+%
+%    If there is no matching database entry or if neither the result
+%    nor the alternate result exist in the font family the requested
+%    new series is used (which then may trigger substitutions later on.
+%    \begin{macrocode}
+\def\DeclareFontSeriesChangeRule#1#2#3#4{%
+  \@namedef{series@#1@#2}{{#3}{#4}}}
+%    \end{macrocode}
+%  \end{macro}
+%
+% \subsection{Mappin rules for series changes}
+%
+% The rules set up use explicit series values not \cs{..default}
+% indirections; my current feeling is that this is in fact better.
+%
+% With 9 weights and 9 width classes this table is getting a bit large
+% in the end (324 entries) but on the other hand it doesn't change and
+% accessing speed and it is not \emph{that} large.
+%
+% \emph{What is missing so far, is a way to state that I want to revert, say
+% the weight to ``regular'' but keep the width or vize versa. That
+% would probably need a new letter due to the double use of ``m''. ---
+%    not quite sure what I meant when I wrote that sentence!}
+%
+%    \begin{macrocode}
+\DeclareFontSeriesChangeRule {m}{c}  {c}  {m}
+\DeclareFontSeriesChangeRule {m}{x}  {x}  {m}
+\DeclareFontSeriesChangeRule {m}{m}  {m}  {}
+\DeclareFontSeriesChangeRule {m}{b}  {b}  {bx}
+\DeclareFontSeriesChangeRule {m}{bx} {bx} {b}
+\DeclareFontSeriesChangeRule {m}{l}  {l}  {m}
+\DeclareFontSeriesChangeRule {m}{sb} {sb} {b}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontSeriesChangeRule {b}{c}  {bc}  {b}
+\DeclareFontSeriesChangeRule {b}{x}  {bx}  {b}
+\DeclareFontSeriesChangeRule {b}{m}  {m}   {}
+\DeclareFontSeriesChangeRule {b}{b}  {b}   {bx}
+\DeclareFontSeriesChangeRule {b}{bx} {bx}  {b}
+\DeclareFontSeriesChangeRule {b}{l}  {l}   {}
+\DeclareFontSeriesChangeRule {b}{sb} {sb}  {b}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontSeriesChangeRule {bx}{c}  {bc}  {bx}
+\DeclareFontSeriesChangeRule {bx}{x}  {bx}  {}
+\DeclareFontSeriesChangeRule {bx}{m}  {m}   {}
+\DeclareFontSeriesChangeRule {bx}{b}  {b}   {bx}
+\DeclareFontSeriesChangeRule {bx}{bx} {bx}  {}
+\DeclareFontSeriesChangeRule {bx}{l}  {lx}  {}
+\DeclareFontSeriesChangeRule {bx}{sb} {sbx} {sb}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontSeriesChangeRule {l}{c}  {lc}  {l}  % ?
+\DeclareFontSeriesChangeRule {l}{x}  {lx}  {l}  % ?
+\DeclareFontSeriesChangeRule {l}{m}  {m}   {}
+\DeclareFontSeriesChangeRule {l}{b}  {b}   {bx}
+\DeclareFontSeriesChangeRule {l}{bx} {bx}  {b}
+\DeclareFontSeriesChangeRule {l}{l}  {l}   {}
+\DeclareFontSeriesChangeRule {l}{sb} {sb}  {b}  % ?
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontSeriesChangeRule {sb}{c}  {sbc} {bc} %?
+\DeclareFontSeriesChangeRule {sb}{x}  {sbx} {bx} %?
+\DeclareFontSeriesChangeRule {sb}{m}  {m}   {}
+\DeclareFontSeriesChangeRule {sb}{b}  {b}   {}
+\DeclareFontSeriesChangeRule {sb}{bx} {bx}  {}
+\DeclareFontSeriesChangeRule {sb}{l}  {l}   {}
+\DeclareFontSeriesChangeRule {sb}{sb} {sb}  {}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontSeriesChangeRule {l}{c}  {c}  {m}  % ?
+%    \end{macrocode}
+%
+%
+% \emph{rules need to get completed!}
+%
+%
+
+% \subsection{Changing to a new series}
+%
+%  \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 at 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 at font@series}.
+%    \begin{macrocode}
+\DeclareRobustCommand\fontseries[1]{\merge at font@series{#1}}
+%    \end{macrocode}
+%  \end{macro}
+
+
+%  \begin{macro}{\merge at 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}
+%    otherwise it will be the two brace groups: the desired result and
+%    the alternate result. The first case means that the third
+%    argument to \cs{merge at font@series} will be empty.
+%    \begin{macrocode}
+\def\merge at font@series#1{%
+  \expandafter\expandafter\expandafter
+  \merge at font@series@
+    \csname series@\f at series @#1\endcsname
+    {#1}%
+    \@nil
+}  
+%    \end{macrocode}
+%  \end{macro}
+
+
+%  \begin{macro}{merge at font@series@}
+%    This now defines the new \cs{f at series}:
+%    \begin{macrocode}
+\def\merge at font@series@#1#2#3\@nil{%
+  \edef\f at series{%
+%    \end{macrocode}
+%    If the third argument is empty there is no database entry for the
+%    combination and the second argument holds the new series so we
+%    return that.
+%    \begin{macrocode}
+    \ifx!#3!%
+      #2%
+    \else
+%    \end{macrocode}
+%    Otherwise we check if the desired result for the series
+%    (\texttt{\#1}) exists for the font family and the current shape.
+%    \begin{macrocode}
+      \expandafter \ifx
+           \csname \f at encoding /\f at family /#1/\f at shape \endcsname
+           \relax
+%    \end{macrocode}
+%    If not, then we try the alternate result (\texttt{\#2}).
+%    \begin{macrocode}
+         \expandafter \ifx
+               \csname \f at encoding /\f at family /#2/\f at shape \endcsname
+               \relax
+%    \end{macrocode}
+%    If that doesn't exist either, then we use the requested series unmodified.
+%    \begin{macrocode}
+           #3%
+%    \end{macrocode}
+%    If the alternate result exist we use that
+%    \begin{macrocode}
+         \else
+           #2%
+         \fi
+%    \end{macrocode}
+%    and if the desired result is available then we use that:
+%    \begin{macrocode}
+      \else
+         #1%
+      \fi
+    \fi
+}}
+%    \end{macrocode}
+%  \end{macro}
+
+
+
+
+
+% \section{Changing the  shape}
+%
+%    Rules for managing shapes (i.e., essentially building in an ``sc''
+%    axis).
+%
+% \emph{write intro}
+%
+%  \begin{macro}{\DeclareFontShapeChangeRule}
+%    The database for shapes is done in exactly the same way, only
+%    that it is much smaller and we usually have no alternative shape
+%    (or rather it is empty thus not used).
+%    \begin{macrocode}
+\def\DeclareFontShapeChangeRule #1#2#3#4{%
+  \@namedef{shape@#1@#2}{{#3}{#4}}}
+%    \end{macrocode}
+%  \end{macro}
+%
+%
+%    There is kind of the same problem with returning back from
+%    \texttt{sc} to normal. It sort of needs its own letter.  In
+%    fontspec this is solved by the first time \cs{upshape} changes
+%    \texttt{it} or \texttt{sl} back (so only \texttt{sc} remains) and
+%    second time it changes then \texttt{sc} back to normal.  Maybe
+%    that's not a bad way to handle it, so I've done that below too.
+%    The alternative would be to provide something like \cs{noscshape}
+%    as the \pkg{slantsc} package does.
+%
+%    That sort of approach doesn't seem possible with the series as
+%    \cs{bfseries} produces \texttt{bx} (normally) and \cs{mdseries}
+%    reverts that back to \texttt{{m} (ie no bold and normal width)
+%    and I think that needs to be preserved.
+%
+%  \begin{macro}{\ulcshape}
+%    To request going back to upper/lowercase we need a new
+%    command. It uses \texttt{ulc} as shape name but this shape is
+%    virtual, i.e., it doesn't exist as a real shape, it is only used
+%    as part of the database table entries and thus only appears in
+%    the second argument there (but not in the first).
+%    \begin{macrocode}
+\DeclareRobustCommand\ulcshape
+        {\not at math@alphabet\ulcshape\relax
+         \fontshape{ulc}\selectfont}
+\DeclareTextFontCommand{\textulc}{\ulcshape}  % back to upper/lower case
+%    \end{macrocode}
+%  \end{macro}
+%
+%
+%
+% \subsection{Mapping rules for shape combinations}
+
+%    \begin{macrocode}
+\DeclareFontShapeChangeRule {n}{n}   {n}   {}
+\DeclareFontShapeChangeRule {n}{it}  {it}  {sl}
+\DeclareFontShapeChangeRule {n}{sl}  {sl}  {it}
+\DeclareFontShapeChangeRule {n}{sc}  {sc}  {}
+\DeclareFontShapeChangeRule {n}{ulc} {n}   {}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontShapeChangeRule {it}{n}   {n}     {}
+\DeclareFontShapeChangeRule {it}{it}  {it}    {}
+\DeclareFontShapeChangeRule {it}{sl}  {sl}    {it}
+\DeclareFontShapeChangeRule {it}{sc}  {scit}  {scsl}  % or sc or it as second default?
+\DeclareFontShapeChangeRule {it}{ulc} {it}    {}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontShapeChangeRule {sl}{n}   {n}     {}
+\DeclareFontShapeChangeRule {sl}{it}  {it}    {sl}
+\DeclareFontShapeChangeRule {sl}{sl}  {sl}    {}
+\DeclareFontShapeChangeRule {sl}{sc}  {scsl}  {scit}  % sc or sl as second default?
+\DeclareFontShapeChangeRule {sl}{ulc} {sl}    {}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontShapeChangeRule {sc}{n}   {n}     {}
+\DeclareFontShapeChangeRule {sc}{it}  {scit}  {scsl}
+\DeclareFontShapeChangeRule {sc}{sl}  {scsl}  {scit}
+\DeclareFontShapeChangeRule {sc}{sc}  {sc}    {}
+\DeclareFontShapeChangeRule {sc}{ulc} {n}     {}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DeclareFontShapeChangeRule {scit}{n}   {sc}    {}
+\DeclareFontShapeChangeRule {scit}{it}  {scit}  {}
+\DeclareFontShapeChangeRule {scit}{sl}  {scsl}  {scit}
+\DeclareFontShapeChangeRule {scit}{sc}  {scit}  {}
+\DeclareFontShapeChangeRule {scit}{ulc} {it}    {}
+%    \end{macrocode}
+%    The previous rule assumes that if \texttt{scit} exists then
+%    \texttt{it} exists as well. If not, the mechanism will save
+%    \texttt{ulc} in \cs{f at 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
+%    faster, but such a  setup would be so weird in the first place
+%    that this isn't worth the effort.
+%
+%    \begin{macrocode}
+\DeclareFontShapeChangeRule {scsl}{n}   {sc}     {}
+\DeclareFontShapeChangeRule {scsl}{it}  {scit}  {scsl}
+\DeclareFontShapeChangeRule {scsl}{sl}  {scsl}  {}
+\DeclareFontShapeChangeRule {scsl}{sc}  {scsl}  {}
+\DeclareFontShapeChangeRule {scsl}{ulc} {sl}    {}
+%    \end{macrocode}
+
+
+%    By the way, fontspec uses \cs{itscdefault} etc.\ whereas in the
+%    \texttt{.fd} files it is always called \texttt{scit}. I
+%    personally kind of think ``\texttt{itsc}'' reads better than
+%    ``\texttt{scit}'' but with more than 700 fonts (in T1 encoding)
+%    having \texttt{scit} and none the other I think the name is now
+%    given.
+%
+%
+% \subsection{Changing to a new shape}
+%
+%  \begin{macro}{\fontshape}
+%    Again the \cs{fontshape} now has to do a lookup to get to its new
+%    value in \cs{f at shape}. The method is exactly the same as in
+%    \csπfontseries}.
+%    \begin{macrocode}
+\DeclareRobustCommand\fontshape[1]{\merge at font@shape{#1}}
+%    \end{macrocode}
+%  \end{macro}
+%
+%
+%  \begin{macro}{\merge at font@shape}
+%    Look up the database entry (if existing) and act accordingly.
+%    \begin{macrocode}
+\def\merge at font@shape#1{%
+  \expandafter\expandafter\expandafter
+  \merge at font@shape@
+    \csname shape@\f at shape @#1\endcsname
+    {#1}%
+    \@nil
+}  
+%    \end{macrocode}
+%  \end{macro}
+%
+
+%  \begin{macro}{\merge at font@shape@}
+%    Same game now, except that we look at shapes not series values.
+%    \begin{macrocode}
+\def\merge at font@shape@#1#2#3\@nil{%
+  \edef\f at shape{%
+    \ifx!#3!%
+      #2%
+    \else
+      \expandafter \ifx
+           \csname \f at encoding /\f at family /\f at series/#1\endcsname
+           \relax
+         \expandafter \ifx
+               \csname \f at encoding /\f at family /\f at series/#2\endcsname
+               \relax
+           #3%
+         \else
+           #2%
+         \fi
+      \else
+         #1%
+      \fi
+    \fi
+}}
+%    \end{macrocode}
+%  \end{macro}
+
+
+
+
+% \section{Supporting nested emphasis}
+
+%    By default \LaTeXe{} supports two levels of nested emphasis: if
+%    the current font has an upright shape then it switches to
+%    \cs{itshape} otherwise to \cs{eminnershape} (which defaults to
+%    \cs{upshape}). This means nested emphasis will ocssilate between
+%    italic and upright shapes.
+%
+%    Sometimes it would be nice to allow for a more lengthly sequence,
+%    but instead of providing a fixed one \LaTeX{} now offers a
+%    general mechanism that allows to define arbitrary sequences.
+%
+%    \DeclareMacro\emfontdeclare
+%    \DeclareMacro\emforce
+%
+%    \emph{decide name! maybe \cs{DeclareEmSequence} ???}
+%
+%    This declaration expects a comma separated list of (font) change
+%    declarations corresponding to increasing levels of emphasis.
+%    The mechanism tries to be ``smart'' and verifies that the
+%    declarations actually alter the font. If not it will ignore this
+%    level and tries the next one---the assumption being that
+%    there was a manual font change in the document to the font that
+%    is now supposed to be used for emphasis. Of course, this only
+%    works if the declarations in the list actually change the font
+%    and not, say, just the color.
+%    In such a case one has to use \cs{emforce} to which directs the
+%    mechanism to use the level even if the font attributes haven't changed.
+%
+%    If the nesting is so deep, that the specified  levels are
+%    exhausted then \cs{emreset} is used as a final set of
+%    declarations (which by default returns
+%    back to the upright shape). ThisAny additional nesting levels will
+%    then reuse the list from its beginning. 
+
+%
+%
+%
+%  \begin{macro}{\emfontdeclare}
+%    
+%    \cs{emfontdeclare| expects a clist of declaration. Spaces in the
+%    argument are dropped to avoid surious spaces in the output. The
+%    declarations are additive. At the very end the shape is reset
+%    using |\emreset| and |\emforce| so that this case is never
+%    skipped.\footnote{Maybe we should not add \cs{emforce} but allow
+%    that case to be  skipped as well. Of course, that might result in
+%    an endless loop if somebody defines a sequence without any font
+%    change and without \cs{emforce} but \ldots}
+%    Further nested calls restart at the beginning.
+%    \begin{macrocode}
+\def\emfontdeclare#1{%
+  \protected at edef\emfontdeclare at clist{\zap at space#1, \@empty\emforce\emreset}%
+}
+%    \end{macrocode}
+%    By default the ist is empty, in which case \cs{eminnershape} is
+%    used by \LaTeX.
+%    \begin{macrocode}
+\let\emfontdeclare at clist\@empty  
+%    \end{macrocode}
+%  \end{macro}
+
+
+
+%  \begin{macro}{\emreset}
+%    Reset the font to upright (this needs to undo \texttt{sc} and
+%    \textt{it} separately as \cs{upshape} no longer resets both in
+%    one go).
+%    \begin{macrocode}
+\def\emreset{\fontshape{ulc}% in case sc is in use, e.g,  changes scit -> it
+             \fontshape{n}%   for all other cases
+}
+%    \end{macrocode}
+%    We could have used \verb=\fontshape{n}= twice, that would give
+%    the same result with the default set of shape rules.
+%  \end{macro}
+
+
+
+%  \begin{macro}{\em}
+%    The new definition for \cs{em} (and implicitly \cs{emph} is like
+%    it was before if \cs{emfontdeclare at clist} is empty.
+%    \begin{macrocode}
+\DeclareRobustCommand\em{%
+  \@nomath\em
+  \ifx\emfontdeclare at clist\@empty
+    \ifdim \fontdimen\@ne\font >\z@
+      \eminnershape \else \itshape \fi
+  \else
+%    \end{macrocode}
+%    But if not we use the list to decide how to do emphasis.
+%
+%    We use the current font to check if the declarations have any
+%    effect, so even a size change is allowed and identified as a
+%    modification (but a color change, for example, isn't).  So first
+%    we save the current status.
+%    \begin{macrocode}
+  \edef\em at currfont{\csname\curr at fontshape/\f at size\endcsname}%
+%    \end{macrocode}
+%    Then we grab the next element from the list and check if it can
+%    be used.
+%    \begin{macrocode}
+    \expandafter\do at emfont@update\emfontdeclare at clist\do at emfont@update
+  \fi
+}
+%    \end{macrocode}
+%  \end{macro}
+
+
+
+%  \begin{macro}{\do at emfont@update}
+%    We know that the list (if not empty) has at least 2 elements
+%    separated by a comma, so we pick up the first in \texttt{\#1} and
+%    the rest in \texttt{\#2}.
+%    \begin{macrocode}
+\def\do at emfont@update#1,#2\do at emfont@update{%
+%    \end{macrocode}
+%    First action is to alter the list and move the first entry to the end
+%    \begin{macrocode}
+  \def\emfontdeclare at clist{#2,#1}%  
+%    \end{macrocode}
+%    Then we execute current declaration. Appending |\selectfont| means one
+%    can write just |\fontshape{it}}| and that works then too.
+%    \begin{macrocode}
+%  \typeout{Use: \detokenize{#1}}%
+  #1\selectfont
+%    \end{macrocode}
+%    We then compare the current font with our saved version, but with
+%    a slight twist: we add \cs{em at force} at the end of the
+%    name. Normally this is empty so has no effect but if there was an
+%    \cs{emforce} as part of \texttt{\#1} it will append a |/| to the
+%    font name (making it invalid) thus this will then always fail the
+%    test.
+%
+%    If the test fails we are done and the declarations will be used.
+%    Otherwise we will try the next declaration in the sequence.
+%    \begin{macrocode}
+  \expandafter\ifx\csname\curr at fontshape/\f at size\em at force\endcsname\em at currfont
+  \expandafter\do at emfont@update\emfontdeclare at clist\do at emfont@update
+%    \end{macrocode}
+%    If \cs{emforce} was used, we have to undo its effect:
+%    \begin{macrocode}
+  \else
+    \let\em at force\@empty
+  \fi
+}
+%    \end{macrocode}
+%  \end{macro}
+
+
+
+%  \begin{macro}{\emforce}
+%  \begin{macro}{\em at force}
+%    The definition of \cs{emforce} is simple: change \cs{em at force} to
+%    make the above test always invalid.
+%    \begin{macrocode}
+\protected\def\emforce{\def\em at force{/}}
+\let\em at force\@empty
+%    \end{macrocode}
+%  \end{macro}
+%  \end{macro}
+
+
+
diff --git a/base/testfiles/tlb-nfssaxes-001.lvt b/base/testfiles/tlb-nfssaxes-001.lvt
new file mode 100644
index 00000000..f88203b1
--- /dev/null
+++ b/base/testfiles/tlb-nfssaxes-001.lvt
@@ -0,0 +1,104 @@
+\documentclass{article}
+
+\input{test2e}
+
+
+
+\def\testseries#1{\showresult{series}{\fontseries{#1}}}
+\def\testshape#1{\showresult{shape}{\fontshape{#1}}}
+\def\showresult#1#2{#2\typeout{\string#2 -> \csname f@#1\endcsname}}
+
+
+
+\begin{document}
+
+\START
+
+\fontencoding{T1}\fontfamily{lmr}\selectfont
+
+
+\typeout{=========== Testing standard shape declarations ==========}
+
+Test
+\showresult{shape}\upshape after upshape
+\showresult{shape}\scshape after scshape
+\showresult{shape}\itshape after itshape
+\showresult{shape}\upshape after upshape
+\showresult{shape}\upshape after upshape
+\showresult{shape}\slshape after slshape
+\showresult{shape}\scshape after scshape
+\showresult{shape}\upshape after upshape
+\showresult{shape}\ulcshape after ulcshape
+
+
+\typeout{=========== Testing low-level \string\fontshape\space declarations ==========}
+
+Testing \verb=\fontshape=
+
+\testshape{n} \selectfont after fontshape ``{n}''
+\testshape{sc} \selectfont after fontshape ``{sc}''
+\testshape{it} \selectfont after fontshape ``{it}''
+\testshape{sl} \selectfont after fontshape ``{sl}''
+\testshape{n} \selectfont after fontshape ``{n}''
+\testshape{ulc} \selectfont after fontshape ``{ulc}''
+
+\typeout{=========== Testing low-level \string\fontseries\space declarations ==========}
+
+Testing \verb=\fontseries=
+
+\testseries{bx} \selectfont after ``{bx}''
+\testseries{l} \selectfont after ``{l}''
+\testseries{c}  \selectfont after ``{c}''  % lc doesn't exist
+\testseries{m}  \selectfont after ``{m} ``
+\testseries{c}  \selectfont after ``{c} ``
+\testseries{b} \selectfont after ``{b}''
+\testseries{bx} \selectfont after ``{bx}''
+\testseries{foo} \selectfont after ``{foo}''
+\testseries{m} \selectfont after ``{m}''
+
+
+\END
+
+
+%---------------------------------
+
+Testing \verb=\fontseries=
+
+\testseries{bx} \selectfont after ``{bx}''
+\testseries{l} \selectfont after ``{l}''
+\testseries{c}  \selectfont after ``{c}''  % lc doesn't exist
+\testseries{m}  \selectfont after ``{m} ``
+\testseries{c}  \selectfont after ``{c} ``
+\testseries{b} \selectfont after ``{b}''
+\testseries{bx} \selectfont after ``{bx}''
+\testseries{foo} \selectfont after ``{foo}''
+\testseries{m} \selectfont after ``{m}''
+
+\fontfamily{lmr}\selectfont
+
+Testing \verb=\..shape=s
+
+Test
+\showresult{shape}\upshape after upshape
+\showresult{shape}\scshape after scshape
+\showresult{shape}\itshape after itshape
+\showresult{shape}\slshape after slshape
+\showresult{shape}\upshape after upshape
+\showresult{shape}\ulcshape after ulcshape
+
+
+%---------------------------------
+
+Testing \verb=\fontshape=
+
+\testshape{n} \selectfont after fontshape ``{n}''
+\testshape{sc} \selectfont after fontshape ``{sc}''
+\testshape{it} \selectfont after fontshape ``{it}''
+\testshape{sl} \selectfont after fontshape ``{sl}''
+\testshape{n} \selectfont after fontshape ``{n}''
+\testshape{ulc} \selectfont after fontshape ``{ulc}''
+
+%---------------------------------
+
+
+\end{document}
diff --git a/base/testfiles/tlb-nfssaxes-001.tlg b/base/testfiles/tlb-nfssaxes-001.tlg
new file mode 100644
index 00000000..51ed476f
--- /dev/null
+++ b/base/testfiles/tlb-nfssaxes-001.tlg
@@ -0,0 +1,34 @@
+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 T1+lmr on input line ....
+=========== Testing standard shape declarations ==========
+\upshape -> n
+\scshape -> sc
+\itshape -> scsl
+\upshape -> sc
+\upshape -> n
+\slshape -> sl
+\scshape -> scsl
+\upshape -> sc
+\ulcshape -> n
+=========== Testing low-level \fontshape declarations ==========
+\fontshape{n} -> n
+\fontshape{sc} -> sc
+\fontshape{it} -> scsl
+\fontshape{sl} -> scsl
+\fontshape{n} -> sc
+\fontshape{ulc} -> n
+=========== Testing low-level \fontseries declarations ==========
+\fontseries{bx} -> bx
+\fontseries{l} -> l
+LaTeX Font Warning: Font shape `T1/lmr/l/n' undefined
+(Font)              using `T1/lmr/m/n' instead on input line ....
+\fontseries{c} -> m
+\fontseries{m} -> m
+\fontseries{c} -> m
+\fontseries{b} -> b
+\fontseries{bx} -> bx
+\fontseries{foo} -> foo
+LaTeX Font Warning: Font shape `T1/lmr/foo/n' undefined
+(Font)              using `T1/lmr/m/n' instead on input line ....
+\fontseries{m} -> m
diff --git a/base/testfiles/tlb-nfssaxes-002.lvt b/base/testfiles/tlb-nfssaxes-002.lvt
new file mode 100644
index 00000000..ba6fbae0
--- /dev/null
+++ b/base/testfiles/tlb-nfssaxes-002.lvt
@@ -0,0 +1,61 @@
+\documentclass{article}
+
+\input{test2e}
+
+
+\def\showresult#1#2{#2\typeout{\string#2 -> \csname f@#1\endcsname}}
+
+
+\begin{document}
+
+\START
+
+%---------------------------------
+
+\typeout{default nesting of emph}
+
+\emph{ Foo \showresult{shape}{}
+  \emph{ Bar \showresult{shape}{}
+    \emph{ Baz \showresult{shape}{}
+      \emph{ FooBar \showresult{shape}{}
+      \emph{ FooBarBaz \showresult{shape}{}
+      \emph{ circle \showresult{shape}{}
+      \emph{ circle2 \showresult{shape}{}
+}}}}}}}
+
+
+
+\typeout{extended nesting of emph using it,n+sc,it+sc}
+
+\emfontdeclare{\fontshape{it},\fontshape{n}\fontshape{sc},\fontshape{it}}
+
+
+\emph{ Foo \showresult{shape}{}
+  \emph{ Bar \showresult{shape}{}
+    \emph{ Baz \showresult{shape}{}
+      \emph{ FooBar \showresult{shape}{}
+      \emph{ FooBarBaz \showresult{shape}{}
+      \emph{ circle \showresult{shape}{}
+      \emph{ circle2 \showresult{shape}{}
+}}}}}}}
+
+
+\typeout{extended nesting of emph using it,n+sc,it+sc in T1/lmr}
+
+\fontencoding{T1}\fontfamily{lmr}\selectfont
+
+\emfontdeclare{\fontshape{it},\fontshape{n}\fontshape{sc},\fontshape{it}}
+
+\emph{ Foo \showresult{shape}{}
+  \emph{ Bar \showresult{shape}{}
+    \emph{ Baz \showresult{shape}{}
+      \emph{ FooBar \showresult{shape}{}
+      \emph{ FooBarBaz \showresult{shape}{}
+      \emph{ circle \showresult{shape}{}
+      \emph{ circle2 \showresult{shape}{}
+}}}}}}}
+
+
+\END
+
+
diff --git a/base/testfiles/tlb-nfssaxes-002.tlg b/base/testfiles/tlb-nfssaxes-002.tlg
new file mode 100644
index 00000000..f76a4045
--- /dev/null
+++ b/base/testfiles/tlb-nfssaxes-002.tlg
@@ -0,0 +1,27 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+default nesting of emph
+ -> it
+ -> n
+ -> it
+ -> n
+ -> it
+ -> n
+ -> it
+extended nesting of emph using it,n+sc,it+sc
+ -> it
+ -> sc
+ -> it
+ -> n
+ -> it
+ -> sc
+ -> it
+extended nesting of emph using it,n+sc,it+sc in T1/lmr
+LaTeX Font Info:    Trying to load font information for T1+lmr on input line ....
+ -> it
+ -> sc
+ -> scsl
+ -> n
+ -> it
+ -> sc
+ -> scsl
diff --git a/base/testfiles/tlb1214.tlg b/base/testfiles/tlb1214.tlg
index 2d80ea23..2c9b61e1 100644
--- a/base/testfiles/tlb1214.tlg
+++ b/base/testfiles/tlb1214.tlg
@@ -59,8 +59,8 @@ LaTeX Font Info:    Font shape `OT1/cmtt/bx/it' in size <10> not available
 LaTeX Font Warning: Font shape `OMS/cmtt/bx/it' undefined
 (Font)              using `OMS/cmtt/bx/n' instead
 (Font)              for symbol `textparagraph' on input line ....
-LaTeX Font Warning: Font shape `OT1/cmtt/bx/sl' undefined
-(Font)              using `OT1/cmtt/bx/n' instead on input line ....
+LaTeX Font Info:    Font shape `OT1/cmtt/bx/sl' in size <10> not available
+(Font)              Font shape `OT1/cmtt/m/n' tried instead on input line ...
 Completed box being shipped out [1]
 \vbox(633.0+0.0)x407.0
 .\glue 16.0
diff --git a/base/testfiles/tnfss3.tlg b/base/testfiles/tnfss3.tlg
index 9cc0955a..ba98ddc8 100644
--- a/base/testfiles/tnfss3.tlg
+++ b/base/testfiles/tnfss3.tlg
@@ -23,9 +23,7 @@ LaTeX Font Warning: Font shape `OT1/cmss/m/sc' in size <8> not available
 (Font)              Font shape `OT1/cmr/m/sc' tried instead on input line ...
 LaTeX Font Warning: Font shape `OT1/cmss/m/sc' in size <14.4> not available
 (Font)              Font shape `OT1/cmr/m/sc' tried instead on input line ...
-LaTeX Font Warning: Font shape `OT1/cmtt/bx/sl' undefined
-(Font)              using `OT1/cmtt/bx/n' instead on input line ....
-LaTeX Font Info:    Font shape `OT1/cmtt/bx/n' in size <14.4> not available
+LaTeX Font Info:    Font shape `OT1/cmtt/bx/sl' in size <14.4> not available
 (Font)              Font shape `OT1/cmtt/m/n' tried instead on input line ...
 LaTeX Font Info:    Font shape `OT1/cmtt/bx/sl' in size <10> not available
 (Font)              Font shape `OT1/cmtt/m/n' tried instead on input line ...
@@ -210,4 +208,3 @@ Completed box being shipped out [1]
 ..\glue(\baselineskip) 30.0
 ..\hbox(0.0+0.0)x345.0
 (tnfss3.aux)
-LaTeX Font Warning: Some font shapes were not available, defaults substituted.





More information about the latex3-commits mailing list