texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Faster font switching


From: Gavin D. Smith
Subject: branch master updated: Faster font switching
Date: Sun, 25 Sep 2022 09:42:38 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new d2be8826ef Faster font switching
d2be8826ef is described below

commit d2be8826ef78bfa6fe859351865d4fe296a33c6d
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Sep 25 14:42:30 2022 +0100

    Faster font switching
    
    * doc/texinfo.tex (\assignfonts, \defineassignfonts):
    \defineassignfonts creates control sequences which are used
    to switch to particular font sizes.  This avoids using \csname
    to define all font styles each time the font size changes.
---
 ChangeLog       |  9 +++++++++
 doc/texinfo.tex | 60 +++++++++++++++++++++++++++++----------------------------
 2 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f1c94a66d0..93e092e07a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-09-25  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       Faster font switching
+
+       * doc/texinfo.tex (\assignfonts, \defineassignfonts):
+       \defineassignfonts creates control sequences which are used
+       to switch to particular font sizes.  This avoids using \csname
+       to define all font styles each time the font size changes.
+
 2022-09-25  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/texinfo.tex (\frenchspacing): Only change \sfcode if
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 7ad6244b8e..de59db7951 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -4,7 +4,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2022-09-25.12}
+\def\texinfoversion{2022-09-25.13}
 %
 % Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
 %
@@ -2545,34 +2545,30 @@ end
   \scriptfont\sffam=\sevensf
 }
 
-%
 
-% The font-changing commands (all called \...fonts) redefine the meanings
-% of \STYLEfont, instead of just \STYLE.  We do this because \STYLE needs
-% to also set the current \fam for math mode.  Our \STYLE (e.g., \rm)
-% commands hardwire \STYLEfont to set the current font.
-%
-% The fonts used for \ifont are for "math italics"  (\itfont is for italics
-% in regular text).  \syfont is also used in math mode only.
-%
-% Each font-changing command also sets the names \lsize (one size lower)
-% and \lllsize (three sizes lower).  These relative commands are used
-% in, e.g., the LaTeX logo and acronyms.
-%
-% This all needs generalizing, badly.
+
+% \defineassignfonts{SIZE} -
+%   Define sequence \assignfontsSIZE, which switches between font sizes
+% by redefining the meanings of \STYLEfont.  (Just \STYLE additionally sets
+% the current \fam for math mode.)
 %
+\def\defineassignfonts#1{%
+  \expandafter\edef\csname assignfonts#1\endcsname{%
+    \let\noexpand\rmfont\csname #1rm\endcsname
+    \let\noexpand\itfont\csname #1it\endcsname
+    \let\noexpand\slfont\csname #1sl\endcsname
+    \let\noexpand\bffont\csname #1bf\endcsname
+    \let\noexpand\ttfont\csname #1tt\endcsname
+    \let\noexpand\smallcaps\csname #1sc\endcsname
+    \let\noexpand\sffont  \csname #1sf\endcsname
+    \let\noexpand\ifont   \csname #1i\endcsname
+    \let\noexpand\syfont  \csname #1sy\endcsname
+    \let\noexpand\ttslfont\csname #1ttsl\endcsname
+  }
+}
 
 \def\assignfonts#1{%
-  \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
-  \expandafter\let\expandafter\itfont\csname #1it\endcsname
-  \expandafter\let\expandafter\slfont\csname #1sl\endcsname
-  \expandafter\let\expandafter\bffont\csname #1bf\endcsname
-  \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
-  \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
-  \expandafter\let\expandafter\sffont  \csname #1sf\endcsname
-  \expandafter\let\expandafter\ifont   \csname #1i\endcsname
-  \expandafter\let\expandafter\syfont  \csname #1sy\endcsname
-  \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
+  \csname assignfonts#1\endcsname
 }
 
 \newif\ifrmisbold
@@ -2596,12 +2592,21 @@ end
    \csname\curfontstyle\endcsname
 }%
 
+% Define the font-changing commands (all called \...fonts).
+% Each font-changing command also sets the names \lsize (one size lower)
+% and \lllsize (three sizes lower).  These relative commands are used
+% in, e.g., the LaTeX logo and acronyms.
+%
+% Note: The fonts used for \ifont are for "math italics"  (\itfont is for
+% italics in regular text).  \syfont is also used in math mode only.
+%
 \def\definefontsetatsize#1#2#3#4#5{%
+  \defineassignfonts{#1}%
 \expandafter\def\csname #1fonts\endcsname{%
   \def\curfontsize{#1}%
   \def\lsize{#2}\def\lllsize{#3}%
   \csname rmisbold#5\endcsname
-  \assignfonts{#1}%
+  \csname assignfonts#1\endcsname
   \resetmathfonts
   \setleading{#4}%
 }}
@@ -2650,7 +2655,6 @@ end
 % print if we are indeed using \tt; #2 is what to print otherwise.
 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
 
-
 % Same as above, but check for italic font.  Actually this also catches
 % non-italic slanted fonts since it is impossible to distinguish them from
 % italic fonts.  But since this is only used by $ and it uses \sl anyway
@@ -2664,8 +2668,6 @@ end
   #2\else#3\fi
 }
 
-
-
 {
 \catcode`\'=\active
 \catcode`\`=\active



reply via email to

[Prev in Thread] Current Thread [Next in Thread]