| 1 |
/* |
| 2 |
|
| 3 |
|
| 4 |
================================================================================ |
| 5 |
== DVI file format == |
| 6 |
================================================================================ |
| 7 |
no_ops >= 0 bytes (NOP, nops before the preamble) |
| 8 |
preamble_marker 1 ubyte (PRE) |
| 9 |
version_id 1 ubyte (should be version 2) |
| 10 |
numerator 4 ubytes (numerater must equal the one in postamble) |
| 11 |
denominator 4 ubytes (denominator must equal the one in postamble) |
| 12 |
magnification 4 ubytes (magnification must equal the one in postamble) |
| 13 |
id_len 1 ubyte (lenght of identification string) |
| 14 |
id_string id_len ubytes (identification string) |
| 15 |
|
| 16 |
no_ops >= 0 bytes (NOP, nops before a page) |
| 17 |
begin_of_page 1 ubyte (BOP) |
| 18 |
page_nr 4 sbytes (page number) |
| 19 |
do_be_do 36 bytes (filler ????) |
| 20 |
prev_page_offset 4 sbytes (offset in file where previous page starts, -1 for none) |
| 21 |
... PAGE DATA ... |
| 22 |
end_of_page 1 ubyte (EOP) |
| 23 |
|
| 24 |
no_ops ??? >= 0 bytes (NOPS, I think they are allowed here...) |
| 25 |
postamble_marker 1 ubyte (POST) |
| 26 |
last_page_offset 4 sbytes (offset in file where last page starts) |
| 27 |
numerator 4 ubytes (numerater must equal the one in preamble) |
| 28 |
denominator 4 ubytes (denominator must equal the one in preamble) |
| 29 |
magnification 4 ubytes (magnification must equal the one in preamble) |
| 30 |
max_page_height 4 ubytes (maximum page height) |
| 31 |
max_page_width 4 ubytes (maximum page width) |
| 32 |
max_stack 2 ubytes (maximum stack depth needed) |
| 33 |
total_pages 2 ubytes (number of pages in file) |
| 34 |
... FONT DEFINITIONS ... |
| 35 |
|
| 36 |
postamble_offset 4 sbytes (offset in file where postamble starts) |
| 37 |
version_id 1 ubyte (should be version 2) |
| 38 |
trailer >= 4 ubytes (TRAILER) |
| 39 |
<EOF> |
| 40 |
|
| 41 |
|
| 42 |
FONT DEFINITIONS: |
| 43 |
do { |
| 44 |
switch (c = getc(dvi_fp) { |
| 45 |
case FNTDEF1 : |
| 46 |
case FNTDEF2 : |
| 47 |
case FNTDEF3 : |
| 48 |
case FNTDEF4 : define_font(c); |
| 49 |
case POSTPOST : break; |
| 50 |
default : error; |
| 51 |
} |
| 52 |
} while (c != POSTPOST); |
| 53 |
|
| 54 |
===== A font def looks like: |
| 55 |
|
| 56 |
1,2,3 or 4 ubytes TeXfontnumber for FNTDEF1 .. FNTDEF4 |
| 57 |
4 ubytes checksum |
| 58 |
4 ubytes scale |
| 59 |
4 ubytes design size |
| 60 |
1 byte deflen1 |
| 61 |
1 byte deflen2 |
| 62 |
deflen1 + deflen2 bytes fontname. |
| 63 |
|
| 64 |
===== A special looks like: |
| 65 |
|
| 66 |
1,2,3 or 4 ubytes telling length of special command for XXX1 .. XXX4 |
| 67 |
all bytes in the special command are used as defined in the dvi driver. |
| 68 |
|
| 69 |
|
| 70 |
-Marcel Mol |
| 71 |
|
| 72 |
|
| 73 |
*/ |
| 74 |
|
| 75 |
From: [email protected] (Joachim Schrod) |
| 76 |
Date: 2 Jan 92 18:26:27 GMT |
| 77 |
|
| 78 |
Since this question comes up often, I post the answer: |
| 79 |
|
| 80 |
The following file format definitions are part of the TUG DVI Driver |
| 81 |
Standards Draft: |
| 82 |
DVI |
| 83 |
GF |
| 84 |
PK |
| 85 |
TFM |
| 86 |
You can ftp them from ftp.th-darmstadt.de, directory |
| 87 |
pub/tex/dvi-standard/standards. |
| 88 |
|
| 89 |
Take either draft-0.05a.tar.Z (the complete standard) or |
| 90 |
<xxx>.tex+fileform.sty where you have to replace <xxx> by dvi, gf, |
| 91 |
etc. |
| 92 |
In the latter case -- when you fetch single files -- you'll need |
| 93 |
to add a LaTeX standard frame (\documentstyle{article} + |
| 94 |
\begin{document} + \end{document}) to get a full, LaTeXable document. |
| 95 |
|
| 96 |
-- |
| 97 |
Joachim |
| 98 |
|
| 99 |
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
| 100 |
Joachim Schrod Email: [email protected] |
| 101 |
Secretary of TUG DVI Driver Standards Committee |
| 102 |
|