%%
%% This is file `textfit.sty', generated
%% on <1995/6/22> with the docstrip utility (1).
%%
%% The original source files were:
%%
%% textfit.dtx (with options: `package')
%% Copyright (C) 1993,94 Sebastian Rahtz and Phil Taylor.
%% All rights reserved. Permission is granted to to
%% customize the declarations in this file to serve the needs of your
%% installation. However, no permission is granted to distribute a
%% modified version of this file under its original name.
%%
\def\fileversion{5}
\def\filedate{1994/04/15}
\def\docdate{1994/04/15}
%% File: textfit.dtx Copyright (C) 1994 Sebastian Rahtz and Phil Taylor
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{textfit}[\filedate]
\newif\ifScalebyMagsteps
\newif\ifNoisyFitting
\NoisyFittingfalse
\ScalebyMagstepsfalse
\DeclareOption{noisy}{\NoisyFittingtrue}
\DeclareOption{magstep}{\ScalebyMagstepstrue}
\ProcessOptions
\newcount \mags@f@r
\newdimen \desired@size
\newcount \r@mainder
\newcount \m@gstepcount
\newcount \m@gsteplimit
\newcount \m@gstepvalue
\newdimen \m@gstepdimen
\def \magsteps {\afterassignment \m@gsteps \m@gsteplimit = }
\def \m@gsteps
{\let \@r = \or
\def \or {\noexpand \or}%
\m@gstepdimen = 0.166667 \maxdimen
\m@gstepvalue = 1000
\m@gstepcount = 0
\def \magstep {}%
\loop
\ifnum \m@gstepcount < \m@gsteplimit
\advance \m@gstepcount by 1
\ifnum \m@gstepvalue > \m@gstepdimen
\advance \m@gstepcount by -1
\message {Sorry --- integer overflow would occur if
I went any further; stopped at
\the \m@gstepcount.}
\m@gsteplimit = \m@gstepcount
\else
\multiply \m@gstepvalue by 12
\multiply \r@mainder by 12
\divide \r@mainder by 10
\advance \m@gstepvalue by \r@mainder
\r@mainder = \m@gstepvalue
\divide \m@gstepvalue by 10
\multiply \m@gstepvalue by 10
\advance \r@mainder by -\m@gstepvalue
\divide \m@gstepvalue by 10
\ifnum \r@mainder < 5
\edef \magstep {\magstep \or \the \m@gstepvalue}%
\else
\advance \m@gstepvalue by 1
\edef \magstep {\magstep \or \the \m@gstepvalue}%
\advance \m@gstepvalue by -1
\fi
\fi
\repeat
\edef \magstep ##1%
{\noexpand \ifcase ##1
1000\magstep
\noexpand \else 0%
\noexpand \message
{Sorry --- \string \magstep \space ##1
is not in range 0 .. \the \m@gsteplimit}%
\noexpand \fi
\noexpand \relax
}%
\let \or = \@r
}
\magsteps 63
\def \Fontname #1{\expandafter \strip@size \fontname #1 }
\def \strip@size #1 #2#{#1\void@@@}
\def \void@@@ #1{}
\gdef\n@d#1.#2:{#1}
\def \@scaletofit[#1]#2#3{%
\def\Hb@x{h}\def\H@rV{#1}%
\ifx\H@rV\Hb@x\def\C@mpare{\wd}\else\def\C@mpare{\ht}\fi
\desired@size #2
\def\curr@fontname{\Fontname \font {} }%
\ifScalebyMagsteps
\mags@f@r \z@
\setbox 0 = \hbox{#3}%
\def\@increment{1}%
\def\@test{<}%
\ifdim \C@mpare 0 > \desired@size
\message{When scaling by Magsteps, you cannot go downwards!}%
\fi
\loop
\font \temp@font = \curr@fontname scaled \magstep \mags@f@r
\setbox 0 = \hbox{{\temp@font #3}}%
\ifNoisyFitting
\message {Trying \noexpand \magstep \the \mags@f@r...}%
\fi
\ifdim \C@mpare 0 \@test \desired@size
\advance \mags@f@r by \@increment
\repeat
\ifnum \mags@f@r=\z@
\mags@f@r1
\fi
\advance \mags@f@r by -\@increment
\else
\font\temp@font=\curr@fontname at1pt
\setbox 0 = \hbox{{\temp@font #3}}%
\@tempdima\C@mpare0
\multiply\@tempdima by 500 %\@m
\def\foo@@{\expandafter\n@d\the\@tempdima:}%
\@tempdimb\desired@size
\divide\@tempdimb by \foo@@
\multiply\@tempdimb by 500 %\@m
\fi
\ifScalebyMagsteps
\ifNoisyFitting
\message {The calculated font is \curr@fontname
scaled \noexpand \magstep \the \mags@f@r}%
\fi
\font \temp@font = \curr@fontname scaled \magstep \mags@f@r
\else
\ifNoisyFitting
\message {The calculated font is \curr@fontname ->\the\@tempdimb}%
\fi
\font\temp@font=\curr@fontname at \the\@tempdimb
\fi
\ifx\H@rV\Hb@x
\hbox to \desired@size {\hss{\temp@font #3}\hss}%
\else
\hbox {{\temp@font #3}}%
\fi
}
\def\scaletowidth{\@scaletofit[h]}
\def\scaletoheight{\@scaletofit[v]}
\endinput
%%
%% End of file `textfit.sty'.
|