home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / useful / dist / text / tex / pastex / macros / latex / nfss2 / nftrace.sty < prev    next >
Text File  |  1993-08-05  |  13KB  |  387 lines

  1. %% 
  2. %% This is file `nftrace.sty', generated 
  3. %% on <1993/8/5> with the docstrip utility (2.0r).
  4. %% 
  5. %% The original source files were:
  6. %% 
  7. %% nftrace.dtx  (with options: `trace,style')
  8. %% 
  9. %% Copyright (C) 1989--1993 by Frank Mittelbach, Rainer Schoepf. 
  10. %% All rights reserved. 
  11. %% 
  12. %% This file is part of the NFSS2 (New Font Selection Scheme) package. 
  13. %% 
  14. %% This package is distributed in the hope that it will be useful, 
  15. %% but WITHOUT ANY WARRANTY; without even the implied warranty of 
  16. %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
  17. %% 
  18. %% 
  19. %% IMPORTANT NOTICE: 
  20. %% 
  21. %% For error reports in case of UNCHANGED versions see readme files. 
  22. %% 
  23. %% Please do not request updates from us directly. Distribution is 
  24. %% done through Mail-Servers and TeX organizations. 
  25. %% 
  26. %% You are not allowed to change this file. You may however copy 
  27. %% this file to a file with a different name and then change the copy 
  28. %% if you obey the restrictions on file changes described in 
  29. %% readme.mz. 
  30. %% 
  31. %% You are allowed to distribute this file under the condition that 
  32. %% it is distributed together with all files mentioned in readme.mz8. 
  33. %% If you receive only some of these files from someone, complain! 
  34. %% 
  35. %% You are NOT ALLOWED to distribute this file alone. You are NOT 
  36. %% ALLOWED to take money for the distribution or use of either this 
  37. %% file or a changed version, except for a nominal charge for copying 
  38. %% etc. 
  39.  
  40. \def\filename{nftrace}
  41. \def\fileversion{v2.1h}
  42. \def\filedate{93/07/16}
  43. \def\docdate {93/07/16}
  44.  
  45.  
  46. %% Copyright (C) 1989-1993 Frank Mittelbach and Rainer Sch\"opf,
  47. %% all rights reserved.
  48. \@ifundefined{DeclareFontShape}
  49.      {\@ifundefined{pickup@font}
  50.         {\@latexerr{The `nftrace' style option can only be used
  51.                     with the new^^Jfont selection scheme}\@eha}
  52.         {\@latexerr{The `nftrace' style option can only be used
  53.                     with the new^^Jfont selection scheme *release 2*}
  54.                    {Your format contains NFSS release 1, but this style
  55.                     option was^^Jdeveloped for release 2.}
  56.         }
  57.       \endinput}
  58.      {}
  59.  \immediate\write\sixt@@n{Style Option: `nftrace'
  60.  \fileversion\space <\filedate>  (FMi and RmS)}
  61. \immediate\write\sixt@@n{English Documentation
  62. \@spaces\@spaces\space  <\docdate>  (FMi and RmS)}
  63. \immediate\write\sixt@@n{Includes module(s):
  64.  trace
  65. }
  66. \def\extract@font{%
  67.    \get@external@font
  68.    \global\expandafter\font\font@name\external@font\relax
  69.     \ifnum \tracingfonts >\@ne
  70.     \font@log{Loading external
  71.              \external@font\space as \font@name\f@warn@break}\fi
  72.     \font@name \relax
  73.     \csname \f@encoding+\f@family\endcsname
  74.     \csname\curr@fontshape\endcsname
  75.     \relax
  76.        }
  77. \def\get@external@font{%
  78.    \let\external@font\@empty
  79.    \edef\font@info{\expandafter\expandafter\expandafter\string
  80.         \csname \curr@fontshape \endcsname}%
  81.    \try@size@range
  82.    \ifx\external@font\@empty
  83.       \try@size@substitution
  84.       \ifx\external@font\@empty
  85.          \errmessage{Font \expandafter \string\font@name\space
  86.                      not found}%
  87.          \error@fontshape
  88.          \get@external@font
  89.    \fi\fi
  90. }
  91.  
  92.  \def\p@selectfont{%
  93.     \xdef\font@name{%
  94.       \csname\curr@fontshape/\f@size\endcsname}%
  95.     \pickup@font
  96.     \font@name
  97.   \ifnum \tracingfonts>\tw@
  98.     \font@log{Switching to \font@name}\fi
  99.       \@tempskipa \f@baselineskip\relax
  100.       \baselineskip \baselinestretch\@tempskipa
  101.     \setbox\strutbox\hbox{\vrule\@height.7\baselineskip
  102.         \@depth.3\baselineskip \@width\z@}%
  103.     \normalbaselineskip\baselineskip
  104.     \ifx \glb@currsize \f@size
  105.      \else
  106.   \ifnum \tracingfonts>\tw@
  107.     \font@log{Changing size to \f@size/\f@baselineskip}\fi
  108.     \ifmath@fonts\else
  109.       \font@log{No math setup}\fi
  110.      \glb@settings \the\every@size
  111.   \ifnum \tracingfonts>\tw@
  112.     \aftergroup\type@restoreinfo \fi
  113.        \aftergroup\glb@settings \fi
  114.   \ifnum \tracingfonts>\tw@
  115.    \gdef\font@restore{\xdef\font@name{%
  116.      \csname\curr@fontshape/\f@size\endcsname}%
  117.      \font@log{Restoring \space\space\space\font@name}%
  118.      \global\let\font@restore\@empty}%
  119.     \aftergroup\font@restore
  120.   \fi
  121.     }
  122.    \def\type@restoreinfo{\font@log{Restoring size
  123.                          or baselineskip to \f@size/\f@baselineskip}}
  124. \def\baselinestretch{1}
  125. \newtoks\every@size
  126. \every@size={}
  127. \def\use@mathgroup#1#2{\relax\ifmmode
  128.   \ifnum \tracingfonts>\tw@
  129.     \count@#2\relax
  130.     \font@log{Using \noexpand\mathgroup
  131.              (\the\count@) #2}\fi
  132.      \math@bgroup
  133.          \expandafter\ifx\csname M@\f@encoding\endcsname#1\else
  134.          #1\fi
  135.          \mathgroup#2\relax
  136.      \expandafter\math@egroup\fi}%
  137.   \ifx\math@bgroup\begingroup
  138.     \def\math@egroup#1{#1\endgroup
  139.       \ifnum \tracingfonts>\tw@
  140.      \font@log{Restoring \noxpand\mathgroup
  141.         (\ifnum\mathgroup=\m@ne default\else \the\mathgroup \fi)%
  142.         }\fi}
  143.   \fi
  144. \def\getanddefine@fonts#1#2{%
  145.   \ifnum \tracingfonts>\tw@
  146.   \count@#1\relax
  147.     \font@log{\noexpand\mathgroup (\the\count@) #1 <-
  148.               \string#2 \tf@size/\sf@size/\ssf@size}\fi
  149.   \xdef\font@name{\csname \string#2/\tf@size\endcsname}%
  150.   \pickup@font \let\textfont@name\font@name
  151.   \xdef\font@name{\csname \string#2/\sf@size\endcsname}%
  152.   \pickup@font \let\scriptfont@name\font@name
  153.   \xdef\font@name{\csname \string#2/\ssf@size\endcsname}%
  154.   \pickup@font
  155.   \edef\math@fonts{\math@fonts
  156.                \textfont#1\textfont@name
  157.                \scriptfont#1\scriptfont@name
  158.                \scriptscriptfont#1\font@name}%
  159.     }
  160. \def\tracingfonts{\font@warning{Command \noexpand\tracingfonts
  161.                   not provided.\f@warn@break
  162.                   Use `nftrace' option in \string\documentstyle\space
  163.                   command.\f@warn@break Command found:}%
  164.                   \count@}
  165. \newcount\tracingfonts
  166. \tracingfonts=1
  167. \def\font@warning#1{%
  168.   \ifnum\tracingfonts>\z@
  169.   \errhelp{This is only a warning message but it gives you^^J%
  170.            time to think about the font substitution above.}%
  171.   \errmessage{NFSS Warning: #1}\else
  172.           \font@trace{#1}%
  173.   \fi
  174.           }
  175. \def\font@trace#1{\immediate\write\sixt@@n
  176.                  {^^JNFSS Info: #1\on@line.^^J}}
  177. \def\font@log#1{%
  178.           \immediate\write\m@ne{NFSS Note: #1\on@line.}}
  179. \def\font@log#1{%
  180.           \immediate\write\sixt@@n{NFSS Note: #1\on@line.}}
  181. \def\ifnot@nil#1{\def\@tempa{#1}%
  182.   \ifx\@tempa\@nnil \expandafter\@gobble\else \expandafter\@iden\fi}
  183. \def\@iden#1{#1}
  184. \def\remove@to@nnil#1\@nnil{}
  185. \def\remove@angles#1>{\set@simple@size@args}
  186. \def\remove@star#1*{#1}
  187. \def\gobble@font@spec#1\@nil<\@nnil{}
  188. \def\extract@sizefn#1*#2\@nil{%
  189.   \if>#2>\set@size@funct@args#1\@nil
  190.          \let\sizefn@info\@empty
  191.   \else\expandafter\set@size@funct@args\remove@star#2\@nil
  192.        \def\sizefn@info{#1}\fi
  193.   }
  194. %% this could be replaced by \try@size@range making the subst slower!
  195. \def\try@simple@size{%
  196.     \def\@tempa{\def\extract@fontinfo####1}%
  197.     \expandafter\@tempa\expandafter<\f@size>##2<##3\@nnil{%
  198.           \ifnot@nil{##2}%
  199.     {\set@simple@size@args##2<##3\@nnil
  200.              \execute@size@function\sizefn@info
  201.             }}%
  202.     \expandafter\expandafter
  203.     \expandafter\extract@fontinfo\expandafter\font@info
  204.     \expandafter<\f@size>\@nil<\@nnil
  205. }
  206. \def\set@simple@size@args#1<{%
  207.           \if<#1<%
  208.     \expandafter\remove@angles
  209.   \else
  210.             \extract@sizefn#1*\@nil
  211.     \expandafter\remove@to@nnil
  212.   \fi}
  213. \def\extract@rangefontinfo#1<#2>{%
  214.        \is@range#2->\@nil#2>}
  215. \def\is@range#1-#2\@nil{%
  216.    \if>#2\expandafter\check@single\else
  217.       \expandafter\check@range\fi}
  218. \newdimen\lower@bound
  219. \newdimen\upper@bound
  220. \def\check@range#1-#2>#3<#4\@nnil{%
  221.   \ifnot@nil{#3}{%
  222.      \def\next{\extract@rangefontinfo<#4\@nnil}%
  223.      \upper@bound0#2\p@
  224.      \ifdim\upper@bound=\z@ \upper@bound\maxdimen\fi
  225.      \ifdim \f@size \p@<\upper@bound
  226.        \lower@bound0#1\p@
  227.        \ifdim \f@size \p@<\lower@bound
  228.         \else
  229.           \set@simple@size@args#3<#4\@nnil
  230.   \execute@size@function\sizefn@info
  231.          \ifx\external@font\@empty
  232.          \else
  233.            \let\next\@empty
  234.          \fi
  235.        \fi
  236.      \fi
  237.      \next}}
  238. \def\check@single#1>#2<#3\@nnil{%
  239.      \def\next{\extract@rangefontinfo<#3\@nnil}%
  240.      \ifdim \f@size \p@=#1\p