From 458ac1dc33cd1cb81d92e545482ce5a8d29bfba0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 13 Jan 2006 00:09:00 +0000 Subject: textfit git-svn-id: svn://tug.org/texlive/trunk@1383 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/textfit/textfit.sty | 145 ++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/textfit/textfit.sty (limited to 'Master/texmf-dist/tex/latex/textfit') 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'. -- cgit v1.2.3