mpl.dviread¶
An experimental module for reading dvi files output by TeX. Several limitations make this not (currently) useful as a general-purpose dvi preprocessor, but it is currently used by the pdf backend for processing usetex text.
Interface:
dvi = Dvi(filename, 72)
# iterate over pages (but only one page is supported for now):
for page in dvi:
w, h, d = page.width, page.height, page.descent
for x,y,font,glyph,width in page.text:
fontname = font.texname
pointsize = font.size
...
for x,y,height,width in page.boxes:
...
Classes¶
Dvi(filename, dpi) |
A dvi (“device-independent”) file, as produced by TeX. |
DviFont(scale, tfm, texname, vf) |
Object that holds a font’s texname and size, supports comparison, and knows the widths of glyphs in the same units as the AFM file. |
Encoding(filename) |
Parses a *.enc file referenced from a psfonts.map style file. |
PsfontsMap(filename) |
A psfonts.map formatted file, mapping TeX fonts to PS fonts. |
Tfm(filename) |
A TeX Font Metric file. |
Vf(filename) |
A virtual font (*.vf file) containing subroutines for dvi files. |
xrange |
xrange(start, stop[, step]) -> xrange object |