[latex3-commits] [git/LaTeX3-latex3-latex2e] gh444: collect the delayed actions and execute them one after another in their original order (defb29f7)

Frank Mittelbach frank.mittelbach at latex-project.org
Sat Dec 5 12:05:55 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh444
Link       : https://github.com/latex3/latex2e/commit/defb29f750d2f7d5ff4d16464d460acc9378779f

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

commit defb29f750d2f7d5ff4d16464d460acc9378779f
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Dec 5 12:05:55 2020 +0100

    collect the delayed actions and execute them one after another in their original order


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

defb29f750d2f7d5ff4d16464d460acc9378779f
 base/ltfssaxes.dtx             |  34 ++++-----
 base/ltfsstrc.dtx              |  12 ++-
 base/testfiles/github-0444.lvt |  43 ++++++++++-
 base/testfiles/github-0444.tlg | 167 ++++++++++++++++++++++++++++++++++++-----
 4 files changed, 208 insertions(+), 48 deletions(-)

diff --git a/base/ltfssaxes.dtx b/base/ltfssaxes.dtx
index 956079b8..9a5dc8d2 100644
--- a/base/ltfssaxes.dtx
+++ b/base/ltfssaxes.dtx
@@ -713,20 +713,21 @@
 %    within the target family and call to \cs{fontseries} might be
 %    followed by a \cs{fontfamily} call. So we delay the processing to
 %    \cs{selectfont} and only record the necessary action in
-%    \cs{delayed at fseries@adjustment}.
+%    \cs{delayed at f@adjustment}.
 % \changes{v1.0c}{2020/02/10}{Switch \cs{if at forced@series} added}
 % \changes{v1.0h}{2020/12/04}{Distangle series and shape update (gh/444)}
 %    \begin{macrocode}
 \DeclareRobustCommand\fontseries[1]{\@forced at seriesfalse
-    \def\delayed at fseries@adjustment{\merge at font@series{#1}}}
+    \expandafter\def\expandafter\delayed at f@adjustment\expandafter
+        {\delayed at f@adjustment\merge at font@series{#1}}}
 %    \end{macrocode}
 %  \end{macro}
 %
 %
-%  \begin{macro}{\delayed at fseries@adjustment}
-%    The macro holding the delayed action for use in \cs{selectfont}.
+%  \begin{macro}{\delayed at f@adjustment}
+%    The macro holding the delayed action(s) for use in \cs{selectfont}.
 %    \begin{macrocode}
-\let\delayed at fseries@adjustment\@empty
+\let\delayed at f@adjustment\@empty
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -738,7 +739,8 @@
 % \changes{v1.0c}{2020/02/10}{Switch \cs{if at forced@series} added}
 %    \begin{macrocode}
 \DeclareRobustCommand\fontseriesforce[1]{\@forced at seriestrue
-    \def\delayed at fseries@adjustment{\edef\f at series{#1}}}
+    \expandafter\def\expandafter\delayed at f@adjustment\expandafter
+      {\delayed at f@adjustment\edef\f at series{#1}}}
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -764,7 +766,7 @@
 %<latexrelease>
 %<latexrelease>\DeclareRobustCommand\fontseries[1]{\@forced at seriesfalse\merge at font@series{#1}}
 %<latexrelease>\DeclareRobustCommand\fontseriesforce[1]{\@forced at seriestrue\edef\f at series{#1}}
-%<latexrelease>\let\delayed at fseries@adjustment\@undefined
+%<latexrelease>\let\delayed at f@adjustment\@undefined
 %<latexrelease>
 %    \end{macrocode}
 %    For a roll forward we may have to define \cs{if at forced@series}
@@ -1278,7 +1280,8 @@
 % \changes{v1.0h}{2020/12/04}{Distangle series and shape update (gh/444)}
 %    \begin{macrocode}
 \DeclareRobustCommand\fontshape[1]
-    {\def\delayed at fshape@adjustment{\merge at font@shape{#1}}}
+   {\expandafter\def\expandafter\delayed at f@adjustment\expandafter
+        {\delayed at f@adjustment\merge at font@shape{#1}}}
 %    \end{macrocode}
 % \changes{v1.0h}{2020/12/04}{Distangle series and shape update (gh/444)}
 %  \end{macro}
@@ -1288,18 +1291,12 @@
 %    The unconditional version:
 %    \begin{macrocode}
 \DeclareRobustCommand\fontshapeforce[1]
-    {\def\delayed at fshape@adjustment{\edef\f at shape{#1}}}
+   {\expandafter\def\expandafter\delayed at f@adjustment\expandafter
+        {\delayed at f@adjustment\edef\f at shape{#1}}}
 %    \end{macrocode}
 %  \end{macro}
-
-%  \begin{macro}{\delayed at fseries@adjustment}
-%    The macro holding the delayed action for use in \cs{selectfont}.
-%    \begin{macrocode}
-\let\delayed at fshape@adjustment\@empty
-%    \end{macrocode}
-%  \end{macro}
-
-
+%
+%
 % Supporting rollback \ldots
 %    \begin{macrocode}
 %</2ekernel|latexrelease>
@@ -1309,7 +1306,6 @@
 %<latexrelease>
 %<latexrelease>\DeclareRobustCommand\fontshape[1]{\merge at font@shape{#1}}
 %<latexrelease>\DeclareRobustCommand\fontshapeforce[1]{\edef\f at shape{#1}}
-%<latexrelease>\let\delayed at fshape@adjustment\@undefined
 %<latexrelease>
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
diff --git a/base/ltfsstrc.dtx b/base/ltfsstrc.dtx
index bae951b8..1542db5f 100644
--- a/base/ltfsstrc.dtx
+++ b/base/ltfsstrc.dtx
@@ -468,15 +468,13 @@
 %    we are ready to change the font face. This way they happen after
 %    a possibly new family is set which is important because they
 %    look at the available font faces in that family and alter the
-%    selection based on availibility. For that reason we also update
-%    the shape first (because they have less variation and seldom
-%    lead to substitution) and only then the series. This should lead
-%    to less substitution cases if th the family has only a
-%    restricted set of font faces.
+%    selection based on availibility. Several calls to \cs{fontseries}
+%    or \cs{fontshape} are delayed in the order in which they appear,
+%    so that by switching them one can work around missing
+%    intermediate font faces and avoid substitutions.
 % \changes{v3.0m}{2020/12/03}{Execute delayed series and shape updates (gh/444)}
 %    \begin{macrocode}
-    \delayed at fshape@adjustment  \let\delayed at fshape@adjustment\@empty
-    \delayed at fseries@adjustment \let\delayed at fseries@adjustment\@empty
+    \delayed at f@adjustment  \let\delayed at f@adjustment\@empty
 %    \end{macrocode}
 %    Then we generate the internal name of the font
 %    by concatenating {\em family}, {\em series},
diff --git a/base/testfiles/github-0444.lvt b/base/testfiles/github-0444.lvt
index d35783c9..46ef084e 100644
--- a/base/testfiles/github-0444.lvt
+++ b/base/testfiles/github-0444.lvt
@@ -1,9 +1,14 @@
 \documentclass{article}
   
-\LoadFontDefinitionFile{OT1}{lmr}
-\DeclareFontShape{OT1}{lmr}{l}{n}%  % pretend we have a "light" series for lmr
+\LoadFontDefinitionFile{T1}{lmr}
+\DeclareFontShape{T1}{lmr}{l}{n}%  % pretend we have a "light" series for lmr
      {<-> ec-lmcsc10}{}
 
+\LoadFontDefinitionFile{T1}{lmss}
+\DeclareFontShape{T1}{lmss}{sb}{n}  % pretend we have a "sb" in lmss
+     {<->ssub * lmss/bx/n}{}
+
+
 \input{test2e}
 
 
@@ -13,10 +18,42 @@
 
 \START
 
+\fontencoding{T1}\selectfont
+
 Test
 
 \fontseries{l}\fontfamily{lmr}\selectfont Small Caps?
 
-\typeout{Font is \the\font \space = OT1/lmr/l/n/10 ? }
+\typeout{Font is \the\font = T1/lmr/l/n/10 ? }
+
+\fontfamily{lmr}
+\fontseries{m}
+\fontshape{sl}
+\fontshape{sc}
+\selectfont  medium small caps sl?   
+
+\typeout{Font is \the\font = T1/lmr/m/scsl/10 ? }
+
+\fontfamily{lmr}
+\fontseries{m}
+\fontshape{n}
+\selectfont  medium?   
+
+\typeout{Font is \the\font = T1/lmr/m/n/10 ? }
+
+
+\fontfamily{lmss}
+\fontseries{c}    % this one doesn't exist
+\fontseries{sb}
+\selectfont  semi-bold condensed? no!  
+
+\typeout{Font is \the\font = T1/lms/bx/n/10 ? }  % because of substitution
+
+\fontfamily{lmss}
+\fontseries{sb}    %this does
+\fontseries{c}     % and the combination too
+\selectfont  semi-bold condensed? this way yes
+
+\typeout{Font is \the\font = T1/lms/sbc/n/10 ? }
 
 \end{document}
diff --git a/base/testfiles/github-0444.tlg b/base/testfiles/github-0444.tlg
index 915f83d9..dc29fcc3 100644
--- a/base/testfiles/github-0444.tlg
+++ b/base/testfiles/github-0444.tlg
@@ -1,6 +1,14 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-Font is \OT1/lmr/l/n/10  = OT1/lmr/l/n/10 ? 
+Font is \T1/lmr/l/n/10 = T1/lmr/l/n/10 ? 
+Font is \T1/lmr/m/scsl/10 = T1/lmr/m/scsl/10 ? 
+Font is \T1/lmr/m/n/10 = T1/lmr/m/n/10 ? 
+LaTeX Font Warning: Font shape `T1/lmss/c/n' undefined
+(Font)              using `T1/lmss/m/n' instead on input line ....
+LaTeX Font Info:    Font shape `T1/lmss/sb/n' in size <10> not available
+(Font)              Font shape `T1/lmss/bx/n' tried instead on input line ...
+Font is \T1/lmss/bx/n/10 = T1/lms/bx/n/10 ? 
+Font is \T1/lmss/sbc/n/10 = T1/lms/sbc/n/10 ? 
 Completed box being shipped out [1]
 \vbox(633.0+0.0)x407.0
 .\glue 16.0
@@ -10,16 +18,16 @@ Completed box being shipped out [1]
 ...\hbox(0.0+0.0)x345.0
 ..\glue 25.0
 ..\glue(\lineskip) 0.0
-..\vbox(550.0+0.0)x345.0, glue set 527.9436fil
+..\vbox(550.0+0.0)x345.0, glue set 479.94873fil
 ...\write-{}
-...\glue(\topskip) 3.16669
-...\hbox(6.83331+0.0)x345.0, glue set 311.33333fil
+...\glue(\topskip) 3.1128
+...\hbox(6.8872+0.0)x345.0, glue set 311.33789fil
 ....\hbox(0.0+0.0)x15.0
-....\OT1/cmr/m/n/10 T
-....\kern-0.83334
-....\OT1/cmr/m/n/10 e
-....\OT1/cmr/m/n/10 s
-....\OT1/cmr/m/n/10 t
+....\T1/cmr/m/n/10 T
+....\kern-0.83313
+....\T1/cmr/m/n/10 e
+....\T1/cmr/m/n/10 s
+....\T1/cmr/m/n/10 t
 ....\penalty 10000
 ....\glue(\parfillskip) 0.0 plus 1.0fil
 ....\glue(\rightskip) 0.0
@@ -27,20 +35,141 @@ Completed box being shipped out [1]
 ...\glue(\baselineskip) 5.11125
 ...\hbox(6.88875+0.0)x345.0, glue set 266.85916fil
 ....\hbox(0.0+0.0)x15.0
-....\OT1/lmr/l/n/10 S
-....\OT1/lmr/l/n/10 m
-....\OT1/lmr/l/n/10 a
-....\OT1/lmr/l/n/10 l
-....\OT1/lmr/l/n/10 l
+....\T1/lmr/l/n/10 S
+....\T1/lmr/l/n/10 m
+....\T1/lmr/l/n/10 a
+....\T1/lmr/l/n/10 l
+....\T1/lmr/l/n/10 l
 ....\glue 3.77774 plus 1.75 minus 1.16666
-....\OT1/lmr/l/n/10 C
-....\OT1/lmr/l/n/10 a
-....\OT1/lmr/l/n/10 p
-....\OT1/lmr/l/n/10 s
-....\OT1/lmr/l/n/10 ?
+....\T1/lmr/l/n/10 C
+....\T1/lmr/l/n/10 a
+....\T1/lmr/l/n/10 p
+....\T1/lmr/l/n/10 s
+....\T1/lmr/l/n/10 ?
 ....\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 217.16466fil
+....\hbox(0.0+0.0)x15.0
+....\T1/lmr/m/scsl/10 m
+....\T1/lmr/m/scsl/10 e
+....\T1/lmr/m/scsl/10 d
+....\T1/lmr/m/scsl/10 i
+....\T1/lmr/m/scsl/10 u
+....\T1/lmr/m/scsl/10 m
+....\glue 3.77774 plus 1.75 minus 1.16666
+....\T1/lmr/m/scsl/10 s
+....\T1/lmr/m/scsl/10 m
+....\T1/lmr/m/scsl/10 a
+....\T1/lmr/m/scsl/10 l
+....\T1/lmr/m/scsl/10 l
+....\glue 3.77774 plus 1.75 minus 1.16666
+....\T1/lmr/m/scsl/10 c
+....\T1/lmr/m/scsl/10 a
+....\T1/lmr/m/scsl/10 p
+....\T1/lmr/m/scsl/10 s
+....\glue 3.77774 plus 1.75 minus 1.16666
+....\T1/lmr/m/scsl/10 s
+....\T1/lmr/m/scsl/10 l
+....\T1/lmr/m/scsl/10 ?
+....\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 290.27876fil
+....\hbox(0.0+0.0)x15.0
+....\T1/lmr/m/n/10 m
+....\T1/lmr/m/n/10 e
+....\T1/lmr/m/n/10 d
+....\T1/lmr/m/n/10 i
+....\T1/lmr/m/n/10 u
+....\T1/lmr/m/n/10 m
+....\T1/lmr/m/n/10 ?
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 5.0555
+...\hbox(6.9445+0.0)x345.0, glue set 210.40103fil
+....\hbox(0.0+0.0)x15.0
+....\T1/lmss/bx/n/10 s
+....\T1/lmss/bx/n/10 e
+....\T1/lmss/bx/n/10 m
+....\T1/lmss/bx/n/10 i
+....\T1/lmss/bx/n/10 -
+....\discretionary
+....\T1/lmss/bx/n/10 b
+....\kern0.30556
+....\T1/lmss/bx/n/10 o
+....\T1/lmss/bx/n/10 l
+....\T1/lmss/bx/n/10 d
+....\glue 3.66666 plus 1.83331 minus 1.22223
+....\T1/lmss/bx/n/10 c
+....\T1/lmss/bx/n/10 o
+....\T1/lmss/bx/n/10 n
+....\T1/lmss/bx/n/10 d
+....\T1/lmss/bx/n/10 e
+....\T1/lmss/bx/n/10 n
+....\T1/lmss/bx/n/10 s
+....\T1/lmss/bx/n/10 e
+....\T1/lmss/bx/n/10 d
+....\T1/lmss/bx/n/10 ?
+....\glue 4.88889 plus 5.49994 minus 0.40741
+....\T1/lmss/bx/n/10 n
+....\T1/lmss/bx/n/10 o
+....\T1/lmss/bx/n/10 !
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 5.0555
+...\hbox(6.9445+1.66666)x345.0, glue set 192.43398fil
+....\hbox(0.0+0.0)x15.0
+....\T1/lmss/sbc/n/10 s
+....\T1/lmss/sbc/n/10 e
+....\T1/lmss/sbc/n/10 m
+....\T1/lmss/sbc/n/10 i
+....\T1/lmss/sbc/n/10 -
+....\discretionary
+....\T1/lmss/sbc/n/10 b
+....\kern0.26387
+....\T1/lmss/sbc/n/10 o
+....\T1/lmss/sbc/n/10 l
+....\T1/lmss/sbc/n/10 d
+....\glue 3.16667 plus 1.58333 minus 1.05554
+....\T1/lmss/sbc/n/10 c
+....\T1/lmss/sbc/n/10 o
+....\T1/lmss/sbc/n/10 n
+....\T1/lmss/sbc/n/10 d
+....\T1/lmss/sbc/n/10 e
+....\T1/lmss/sbc/n/10 n
+....\T1/lmss/sbc/n/10 s
+....\T1/lmss/sbc/n/10 e
+....\T1/lmss/sbc/n/10 d
+....\T1/lmss/sbc/n/10 ?
+....\glue 4.22221 plus 4.74998 minus 0.35184
+....\T1/lmss/sbc/n/10 t
+....\T1/lmss/sbc/n/10 h
+....\T1/lmss/sbc/n/10 i
+....\T1/lmss/sbc/n/10 s
+....\glue 3.16667 plus 1.58333 minus 1.05554
+....\T1/lmss/sbc/n/10 w
+....\kern-0.26389
+....\T1/lmss/sbc/n/10 a
+....\kern-0.26389
+....\T1/lmss/sbc/n/10 y
+....\glue 3.16667 plus 1.58333 minus 1.05554
+....\T1/lmss/sbc/n/10 y
+....\kern-0.26389
+....\T1/lmss/sbc/n/10 e
+....\T1/lmss/sbc/n/10 s
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue -1.66666
 ...\glue 0.0 plus 1.0fil
 ...\glue 0.0
 ...\glue 0.0 plus 0.0001fil





More information about the latex3-commits mailing list.