[OS X TeX] scaling fonts in latex

Bruno Voisin bvoisin at mac.com
Wed Mar 23 04:39:31 EST 2005


Le 23 mars 05, à 09:59, Thomas A.Schmitz a écrit :

> NOW the question: I would like to have a second option to the package 
> that would scale the font in relation to the main bodyfont of the 
> document, something similar to what the helvet.sty package does:
> \usepackage[Gentium,scale=.95]
> e.g., to scale the Gentium font to 95 %. I tried and looked in the 
> helvet.sty to see how it is done there, but my latex knowledge just 
> isn't sufficient to do this (I usually use context). I think I need 
> the keyval package, but I can't see where the scale-declaration would 
> go. Can anybody help?

It's done through the conjunction of helvet.sty and the accompanying 
.fd files, and does indeed require the package keyval.sty. In essence, 
the code inside helvet.sty defines \Hv at scale as <number> when the 
package is called with the option [scale=<number>], and then the .fd 
files use that value as a scale multiplier when calling the .tfm font 
metric files. For example, inside ot1phv.fd you have:

> \expandafter\ifx\csname Hv at scale\endcsname\relax
>  \let\Hv@@scale\@empty
> \else
>  \edef\Hv@@scale{s*[\csname Hv at scale\endcsname]}%
> \fi
>
> \DeclareFontFamily{OT1}{phv}{}
> \DeclareFontShape{OT1}{phv}{m}{n}{
>    <-> \Hv@@scale phvr7t
> }{}

which defines \Hv@@scale as the scale multiplier (in LaTeX's 2e 
low-level font syntax) s*[\Hv at scale], and defines the phv font family 
in medium series and normal shape to refer to the metrics phvr7t.tfm 
preceded by \Hv@@scale. For this low-level syntax, see section 4 of 
/Library/teTeX/share/texmf.tetex/doc/latex/base/fntguide.dvi.

I think Herb Schulz from this list has written a custom package 
extending this mechanism to other fonts than Helvetica.

Hope this helps,

Bruno Voisin

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list