Crate dvi [] [src]

Dvi format

The dvi format is an ancient format to abstract differences between different printing environments. A program would be provided with the printer hardware to convert dvi into instructions for the print head, which would then produce the desired content on the printed page. This means that a dvi document is essentially a set of instructions for which glyphs to draw where on each page.

It has largely been superseeded, with postscript (ps) and then protable document format (pdf) becoming the dominant document format.

However, it is quite a simple protocol, and it may be useful for working with documents in this format, hence the motivation for writing a library.

A dvi file is a sequence of Instructions. See the Instruction enum for details of the different instructions contained.

Note that currently paths must be utf8, and parsing will error if this is not true

Implementation notes

An instruction is a u8, followed by 0 or more instruction-specific parameters All multi-byte values are big-endian. All values are unsigned, except for 4-byte which is always i32, and distance values, which are signed. Signed values use 2s-complement (same as rust).

See SPECIFICATION.md for more details

Structs

FontDef

A font definition

Enums

IResult

Holds the result of parsing functions

Instruction

A draw instruction

Traits

Dump

A type that can be written to a stream (serialized)

Parse

A type that can be parsed from a byte slice