TeX::DVI -- write out TeX's DVI (DeVice Independent) file
use TeX::DVI; use Font::TFM; my $dvi = new TeX::DVI "texput.dvi"; my $font = new_at Font::TFM "cmr10", 12 or die "Error loading cmr10 at 12 pt: $Font::TFM::errstr\n"; $dvi->preamble(); $dvi->begin_page(); $dvi->push(); my $fn = $dvi->font_def($font); $dvi->font($fn); $dvi->word("difficulty"); $dvi->hskip($font->space()); $dvi->word("AVA"); $dvi->black_box($font->em_width(), $font->x_height()); $dvi->pop(); $dvi->end_page(); $dvi->postamble(); $dvi->close();
Method TeX::DVI::new creates a new DVI object in memory and opens the output DVI file. After that, elements can be written into the file using appropriate methods.
These are the methods available on the Font::TFM object:
Writes out appropriate command of the .dvi file.
.dvi
The parameter is a reference to a Font::TFM object. Info out of this object will be printed out. The method returns the internal number of the font in this .dvi file.
Writes out the font_sel command, the parametr is the number returned by font_def.
Skips.
Creates a black box, can be used for hrules and vrules.
Writes out the special command, one parameter is written as the command.
Writes out a word given as the first parameter. The currently selected font is used to gather information about ligatures and kernings, that's why it's possible to say
$dvi->word("difficulty");
and the ffi will be ligatured all right.
ffi
Close the file.
The error handling is rather weak -- the modul currently assumes you know why you call the method you call.
1.01
http://www.adelton.com/perl/TeX-DVI/
(c) 1996--2011 Jan Pazdziora.
All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Contact the author at jpx dash perl at adelton dot com.
Font::TFM(3), TeX::DVI::Parse(3), perl(1).
To install TeX::DVI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TeX::DVI
CPAN shell
perl -MCPAN -e shell install TeX::DVI
For more information on module installation, please visit the detailed CPAN module installation guide.