| 1 |
This file is public domain. |
| 2 |
Originally written 1995, Geoffrey Tobin. |
| 3 |
The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation. |
| 4 |
This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin. |
| 5 |
|
| 6 |
``dvi.doc'' |
| 7 |
Mon 27 Feb 1995 |
| 8 |
Geoffrey Tobin |
| 9 |
|
| 10 |
Description of the DVI file structure. |
| 11 |
-------------------------------------- |
| 12 |
|
| 13 |
Reference: |
| 14 |
---------- |
| 15 |
|
| 16 |
CTAN: dviware/driv-standard/level-0/dvistd0.tex |
| 17 |
|
| 18 |
"The DVI Driver Standard, Level 0", |
| 19 |
by The TUG DVI Driver Standards Committee (now defunct) |
| 20 |
chaired by Joachim Schrod. |
| 21 |
Appendix A, "Device-Independent File Format", |
| 22 |
section A.2, "Summary of DVI commands". |
| 23 |
|
| 24 |
|
| 25 |
DVI Commands |
| 26 |
------------ |
| 27 |
Listed in the free format: |
| 28 |
"Opcode Symbol Parameter[Signed? Bytes] ... Action". |
| 29 |
|
| 30 |
|
| 31 |
0 set_char_0 - set character 0 from current font |
| 32 |
... |
| 33 |
127 set_char_127 - set character 127 from current font |
| 34 |
|
| 35 |
128 set1 c[1] - set 1-byte unsigned character (uchar) number c |
| 36 |
129 set2 c[2] - set 2-byte uchar number c |
| 37 |
130 set3 c[3] - set 3-byte uchar number c |
| 38 |
131 set4 c[+4] - set 4-byte signed character (schar) number c |
| 39 |
|
| 40 |
132 set_rule a[+4] b[+4] - set rule, height a, width b |
| 41 |
|
| 42 |
133 put1 c[1] - put 1-byte uchar c |
| 43 |
134 put2 c[2] - put 2-byte uchar |
| 44 |
135 put3 c[3] - put 3-byte uchar |
| 45 |
136 put4 c[+4] - put 4-byte schar |
| 46 |
|
| 47 |
137 put_rule a[+4] b[+4] - put rule, height a, width b |
| 48 |
|
| 49 |
138 nop - do nothing |
| 50 |
|
| 51 |
139 bop c0[+4] ... c9[+4] p[+4] - beginning of page |
| 52 |
140 eop - end of page |
| 53 |
|
| 54 |
141 push - push (h,v,w,x,y,z) onto stack |
| 55 |
142 pop - pop (h,v,w,x,y,z) from stack |
| 56 |
|
| 57 |
143 right1 b[+1] - move right b units |
| 58 |
144 right2 b[+2] - move right b units |
| 59 |
145 right3 b[+3] - move right b units |
| 60 |
146 right4 b[+4] - move right b units |
| 61 |
|
| 62 |
147 w0 - move right w units |
| 63 |
148 w1 b[+1] - move right b units, and set w = b |
| 64 |
149 w2 b[+2] - move right b units, and set w = b |
| 65 |
150 w3 b[+3] - move right b units, and set w = b |
| 66 |
151 w4 b[+4] - move right b units, and set w = b |
| 67 |
|
| 68 |
152 x0 - move right x units |
| 69 |
153 x1 b[+1] - move right b units, and set x = b |
| 70 |
154 x2 b[+2] - move right b units, and set x = b |
| 71 |
155 x3 b[+3] - move right b units, and set x = b |
| 72 |
156 x4 b[+4] - move right b units, and set x = b |
| 73 |
|
| 74 |
157 down1 a[+1] - move down a units |
| 75 |
158 down2 a[+2] - move down a units |
| 76 |
159 down3 a[+3] - move down a units |
| 77 |
160 down4 a[+4] - move down a units |
| 78 |
|
| 79 |
161 y0 - move right y units |
| 80 |
162 y1 a[+1] - move right a units, and set y = a |
| 81 |
163 y2 a[+2] - move right a units, and set y = a |
| 82 |
164 y3 a[+3] - move right a units, and set y = a |
| 83 |
165 y4 a[+4] - move right a units, and set y = a |
| 84 |
|
| 85 |
166 z0 - move right z units |
| 86 |
167 z1 a[+1] - move right a units, and set z = a |
| 87 |
168 z2 a[+2] - move right a units, and set z = a |
| 88 |
169 z3 a[+3] - move right a units, and set z = a |
| 89 |
170 z4 a[+4] - move right a units, and set z = a |
| 90 |
|
| 91 |
171 fnt_num_0 - set current font number (f) = 0 |
| 92 |
... |
| 93 |
234 fnt_num_63 - set f = 63 |
| 94 |
|
| 95 |
235 fnt1 k[1] - set f = k |
| 96 |
236 fnt2 k[2] - set f = k |
| 97 |
237 fnt3 k[3] - set f = k |
| 98 |
238 fnt4 k[+4] - set f = k |
| 99 |
|
| 100 |
239 xxx1 k[1] x[k] - special string x with k bytes |
| 101 |
240 xxx2 k[2] x[k] - special string x with k bytes |
| 102 |
241 xxx3 k[3] x[k] - special string x with k bytes |
| 103 |
242 xxx4 k[4] x[k] - special string x with (unsigned) k bytes |
| 104 |
|
| 105 |
243 fnt_def1 k[1] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k |
| 106 |
244 fnt_def2 k[2] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k |
| 107 |
245 fnt_def3 k[3] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k |
| 108 |
246 fnt_def4 k[+4] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k |
| 109 |
|
| 110 |
247 pre i[1] num[4] den[4] mag[4] k[1] x[k] - begin preamble |
| 111 |
|
| 112 |
248 post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2] - begin postamble |
| 113 |
249 post_post q[4] i[1] 223 ... 223 - end postamble |
| 114 |
|
| 115 |
250 - undefined |
| 116 |
... |
| 117 |
255 - undefined |
| 118 |
|
| 119 |
In bop: |
| 120 |
|
| 121 |
c0[+4] ... c9[+4] = page counters, \`a la TeX. |
| 122 |
p[+4] = pointer to previous bop (its byte address); first bop has p = -1 . |
| 123 |
|
| 124 |
In the font definitions: |
| 125 |
|
| 126 |
c[4] = check sum for TFM file. |
| 127 |
s[4] = scale factor, in DVI units. |
| 128 |
d[4] = design size, in DVI units. |
| 129 |
a[1] = length of the "area" or directory. |
| 130 |
l[1] = length of the font name. |
| 131 |
n[a+l] = area and font name string(s). |
| 132 |
|
| 133 |
In the preamble: |
| 134 |
|
| 135 |
i[1] = DVI format ID = 2, except TeX-XeT has 3. |
| 136 |
num[4] = numerator of 100 nm / DVI unit. |
| 137 |
den[4] = denominator of 100 nm / DVI unit. |
| 138 |
mag[4] = 1000 * magnification. |
| 139 |
k[1] = comment length. |
| 140 |
x[k] = comment string. |
| 141 |
|
| 142 |
In the postamble: |
| 143 |
|
| 144 |
p[4] = pointer to final bop. |
| 145 |
num[4], den[4], mag[4] = duplicates of values in preamble. |
| 146 |
l[4] = height-plus-depth of tallest page, in DVI units. |
| 147 |
u[4] = width of widest page, in DVI units. |
| 148 |
s[2] = maximum stack depth needed to process this DVI file. |
| 149 |
t[2] = total number of pages (bop commands) present. |
| 150 |
|
| 151 |
In the post-postamble: |
| 152 |
|
| 153 |
q[4] = pointer to the "post" command that started the postamble. |
| 154 |
i[1] = DVI format ID, as in the preamble. |
| 155 |
223 ... 223 = at least four "223" bytes. |
| 156 |
|
| 157 |
--------------- |
| 158 |
EOF ``dvi.doc'' |
| 159 |
--------------- |