[latex3-commits] [git/LaTeX3-latex3-latex2e] gh444: added everyself replacement (not covering CJK - should be done there) added test for everysel (dd29723c)
Frank Mittelbach
frank.mittelbach at latex-project.org
Fri Dec 4 22:05:24 CET 2020
Repository : https://github.com/latex3/latex2e
On branch : gh444
Link : https://github.com/latex3/latex2e/commit/dd29723c3a21401cd4b5e4dfe8cbd197b0ce9ec9
>---------------------------------------------------------------
commit dd29723c3a21401cd4b5e4dfe8cbd197b0ce9ec9
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Fri Dec 4 22:05:24 2020 +0100
added everyself replacement (not covering CJK - should be done there)
added test for everysel
>---------------------------------------------------------------
dd29723c3a21401cd4b5e4dfe8cbd197b0ce9ec9
base/ltfinal.dtx | 5 ++++-
base/ltfsstrc.dtx | 25 ++++++++++++-------------
base/testfiles-search/tlb-everysel-001.lvt | 19 +++++++++++++++++++
base/testfiles-search/tlb-everysel-001.tlg | 9 +++++++++
4 files changed, 44 insertions(+), 14 deletions(-)
diff --git a/base/ltfinal.dtx b/base/ltfinal.dtx
index 4b9ee6c4..1ba47d54 100644
--- a/base/ltfinal.dtx
+++ b/base/ltfinal.dtx
@@ -119,7 +119,10 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ERROR needs content
+\newcommand*{\EverySelectfont}[1]
+ {\AddToHook{selectfont}{#1}}
+\newcommand*{\AtNextSelectfont}[1]
+ {\AddToHookNext{selectfont}{#1}}
% \end{macrocode}
%
%
diff --git a/base/ltfsstrc.dtx b/base/ltfsstrc.dtx
index 7fef4531..17f5ed9a 100644
--- a/base/ltfsstrc.dtx
+++ b/base/ltfsstrc.dtx
@@ -508,19 +508,6 @@
% \begin{macrocode}
\UseHook{selectfont}%
% \end{macrocode}
-% If |\tracingfonts| is
-% greater than 2 we also show the font switch.
-% We do this before |\glb at settings| is called since this
-% macro might redefine |\font at name|.
-% \changes{v1.0k}{1990/03/14}{Added code for TeX3.}
-% \changes{v1.0i}{1990/02/16}{Changed \cs{f at size} to \cs{lcl at currsize}
-% (see fam file).}
-% \begin{macrocode}
-%<*trace>
- \ifnum \tracingfonts>\tw@
- \@font at info{Switching to \font at name}\fi
-%</trace>
-% \end{macrocode}
% Finally we call |\size at update|. This macro is normally empty but
% will contain actions (like setting the |\baselineskip|) that have
% to be carried out when the font size, the base |\baselineskip| or
@@ -552,6 +539,18 @@
% \end{macro}
%
%
+% If |\tracingfonts| is
+% greater than 2 we also show the font switch inside \cs{selectfont}.
+% We do this by adding this code to the hook in the \pkg{tracefnt} package:
+% macro might redefine |\font at name|.
+% \begin{macrocode}
+%<*trace>
+\AddToHook{selectfont}
+ {\ifnum \tracingfonts>\tw@
+ \@font at info{Switching to \font at name}\fi}}
+%</trace>
+% \end{macrocode}
+%
%
% \begin{macrocode}
%</2ekernel|latexrelease|package>
diff --git a/base/testfiles-search/tlb-everysel-001.lvt b/base/testfiles-search/tlb-everysel-001.lvt
new file mode 100644
index 00000000..ab5ad7f2
--- /dev/null
+++ b/base/testfiles-search/tlb-everysel-001.lvt
@@ -0,0 +1,19 @@
+\documentclass{article}
+
+\input{test2e}
+
+\usepackage{everysel}
+
+\EverySelectfont{\typeout{Switched to \the\font}}
+
+\begin{document}
+
+\START
+
+\ttfamily X \itshape Y
+
+\AtNextSelectfont{\typeout{Really!}}
+
+\sffamily Z \upshape ?
+
+\END
diff --git a/base/testfiles-search/tlb-everysel-001.tlg b/base/testfiles-search/tlb-everysel-001.tlg
new file mode 100644
index 00000000..5160de9f
--- /dev/null
+++ b/base/testfiles-search/tlb-everysel-001.tlg
@@ -0,0 +1,9 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+Switched to \OT1/cmtt/m/n/10
+Switched to \OT1/cmtt/m/it/10
+LaTeX Font Info: Font shape `OT1/cmss/m/it' in size <10> not available
+(Font) Font shape `OT1/cmss/m/sl' tried instead on input line ....
+Switched to \OT1/cmss/m/sl/10
+Really!
+Switched to \OT1/cmss/m/n/10
More information about the latex3-commits
mailing list.