NAME

Font::TFM -- read and work with TeX font metric files

SYNOPSIS

use Font::TFM;  
### $Font::TFM::TEXFONTSDIR = "your directories";

my $cmr = new Font::TFM "cmr10";
(defined $cmr) or die "Error reading font\n";
print "Designsize: ", $cmr->designsize(), "\n";
print $cmr->width("A"), ", ", $cmr->kern('Wo'), "\n";

should print on the output

Designsize: 10
491521.25, -54613.75

DESCRIPTION

Method Font::TFM::new creates a new TFM object in memory, loading all the necessary information from the .tfm file. Second (optional) parameter means scale. You can also use Font::TFM::new_at and as the second parameter put requested size in pt.

List of comma separated directories to be searched is in variable $Font::TFM::TEXFONTSDIR. These are searched for given .tfm file (extension .tfm is optional in the call to Font::TFM::new). Variable $Font::TFM::TEXFONTSUSELS can be set to zero to disable using ls-R files. If it is kept equal to 1, once it finds file with name $Font::TFM::LSFILENAME, it doesn't search through the subdirectories and only uses info in this file fo find the .tfm file.

These are the methods available on the Font::TFM object:

designsize, fontsize

Returns the design size and the actual size of the font in pt.

width, height, depth, italic

Returns the requested dimension for a specified character of the font.

kern, lig, ligpassover

For a two-letter string returns kern between them, ligature formed and number of characters to pass over after the ligature.

expand

One string parameter undergoes ligature expansion and then kernings are inserted. Returns array of string, kern, string, ...

word_dimensions

Returns the width, height and depth of a word. Does the lig/kern expansion, so the result is the real space it will take on output.

word_width, word_height, word_depth

Calls word_dimensions and returns appropriate element. No caching is done, so it is better to call word_dimensions yourself if you will need more than one dimension of one word.

param

Returns parameter of the font, indexed from 1.

slant, x_height, em_width, quad
space, space_stretch, space_shrink, extra_space

Returns the parameter of the font.

name

Returns the name of the font.

Dimensions are multiplied by $Font::TFM::MULTIPLY * actual size of the font. Value of $Font::TFM::MULTIPLY defaults to 65536, so the dimensions can be used directly when writing the .dvi file.

Variable $Font::TFM::DEBUG may be set to 1 to get the processing messages on the standard error output.

CHANGES

0.05 Tue Aug 19 10:09:27 MET DST 1997

Minor bug fixes. Module made use strict clean. Tests added.

0.04 Wed Apr 9 10:20:10 MET DST 1997

Font::TFM::word_dimensions added, Font::TFM::word_width and new Font::TFM::word_height and Font::TFM::word_depth now call it.

Font::TFM::MULTIPLY added, still defaults do 65535.

Module made faster, also uses AUTOLOAD for many things. Minor bug fixes.

0.03 Sun Feb 16 13:55:26 MET 1997

Font::TFM::expand added to provide lig/kern expansion.

Font::TFM::word_width added to measure width of word on output.

Font::TFM::em_width and TFM::name added.

Name Font::TFM set up instead of TFM.

0.02 Thu Feb 13 20:43:38 MET 1997

First version released/announced on public.

VERSION

0.05

SEE ALSO

TeX::DVI(3), TeX::DVI::Parse(3), perl(1).

AUTHOR

(c) 1996, 1997 Jan Pazdziora, adelton@fi.muni.cz

at Faculty of Informatics, Masaryk University, Brno