summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:09:00 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:09:00 +0000
commit458ac1dc33cd1cb81d92e545482ce5a8d29bfba0 (patch)
treed6eb98e90e4b103a8063c5af476433d4673e161a /Master
parent6b1cde0d4133b76c47fdfc31d2d53c00d1c22c4a (diff)
textfit
git-svn-id: svn://tug.org/texlive/trunk@1383 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/tex/latex/textfit/textfit.sty145
1 files changed, 145 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/textfit/textfit.sty b/Master/texmf-dist/tex/latex/textfit/textfit.sty
new file mode 100644
index 00000000000..762e39dceb9
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/textfit/textfit.sty
@@ -0,0 +1,145 @@
+%%
+%% This is file `textfit.sty',
+%% generated with the docstrip utility.
+%%
+%% 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'.