/* ================================================================================ == DVI file format == ================================================================================ no_ops >= 0 bytes (NOP, nops before the preamble) preamble_marker 1 ubyte (PRE) version_id 1 ubyte (should be version 2) numerator 4 ubytes (numerater must equal the one in postamble) denominator 4 ubytes (denominator must equal the one in postamble) magnification 4 ubytes (magnification must equal the one in postamble) id_len 1 ubyte (lenght of identification string) id_string id_len ubytes (identification string) no_ops >= 0 bytes (NOP, nops before a page) begin_of_page 1 ubyte (BOP) page_nr 4 sbytes (page number) do_be_do 36 bytes (filler ????) prev_page_offset 4 sbytes (offset in file where previous page starts, -1 for none) ... PAGE DATA ... end_of_page 1 ubyte (EOP) no_ops ??? >= 0 bytes (NOPS, I think they are allowed here...) postamble_marker 1 ubyte (POST) last_page_offset 4 sbytes (offset in file where last page starts) numerator 4 ubytes (numerater must equal the one in preamble) denominator 4 ubytes (denominator must equal the one in preamble) magnification 4 ubytes (magnification must equal the one in preamble) max_page_height 4 ubytes (maximum page height) max_page_width 4 ubytes (maximum page width) max_stack 2 ubytes (maximum stack depth needed) total_pages 2 ubytes (number of pages in file) ... FONT DEFINITIONS ... postamble_offset 4 sbytes (offset in file where postamble starts) version_id 1 ubyte (should be version 2) trailer >= 4 ubytes (TRAILER) FONT DEFINITIONS: do { switch (c = getc(dvi_fp) { case FNTDEF1 : case FNTDEF2 : case FNTDEF3 : case FNTDEF4 : define_font(c); case POSTPOST : break; default : error; } } while (c != POSTPOST); ===== A font def looks like: 1,2,3 or 4 ubytes TeXfontnumber for FNTDEF1 .. FNTDEF4 4 ubytes checksum 4 ubytes scale 4 ubytes design size 1 byte deflen1 1 byte deflen2 deflen1 + deflen2 bytes fontname. ===== A special looks like: 1,2,3 or 4 ubytes telling length of special command for XXX1 .. XXX4 all bytes in the special command are used as defined in the dvi driver. -Marcel Mol */ From: schrod@iti.informatik.th-darmstadt.de (Joachim Schrod) Date: 2 Jan 92 18:26:27 GMT Since this question comes up often, I post the answer: The following file format definitions are part of the TUG DVI Driver Standards Draft: DVI GF PK TFM You can ftp them from ftp.th-darmstadt.de, directory pub/tex/dvi-standard/standards. Take either draft-0.05a.tar.Z (the complete standard) or .tex+fileform.sty where you have to replace by dvi, gf, etc. In the latter case -- when you fetch single files -- you'll need to add a LaTeX standard frame (\documentstyle{article} + \begin{document} + \end{document}) to get a full, LaTeXable document. -- Joachim =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Joachim Schrod Email: schrod@iti.informatik.th-darmstadt.de Secretary of TUG DVI Driver Standards Committee