``dvi.doc'' Mon 27 Feb 1995 Geoffrey Tobin Description of the DVI file structure. -------------------------------------- Reference: ---------- CTAN: dviware/driv-standard/level-0/dvistd0.tex "The DVI Driver Standard, Level 0", by The TUG DVI Driver Standards Committee (now defunct) chaired by Joachim Schrod. Appendix A, "Device-Independent File Format", section A.2, "Summary of DVI commands". DVI Commands ------------ Listed in the free format: "Opcode Symbol Parameter[Signed? Bytes] ... Action". 0 set_char_0 - set character 0 from current font ... 127 set_char_127 - set character 127 from current font 128 set1 c[1] - set 1-byte unsigned character (uchar) number c 129 set2 c[2] - set 2-byte uchar number c 130 set3 c[3] - set 3-byte uchar number c 131 set4 c[+4] - set 4-byte signed character (schar) number c 132 set_rule a[+4] b[+4] - set rule, height a, width b 133 put1 c[1] - put 1-byte uchar c 134 put2 c[2] - put 2-byte uchar 135 put3 c[3] - put 3-byte uchar 136 put4 c[+4] - put 4-byte schar 137 put_rule a[+4] b[+4] - put rule, height a, width b 138 nop - do nothing 139 bop c0[+4] ... c9[+4] p[+4] - beginning of page 140 eop - end of page 141 push - push (h,v,w,x,y,z) onto stack 142 pop - pop (h,v,w,x,y,z) from stack 143 right1 b[+1] - move right b units 144 right2 b[+2] - move right b units 145 right3 b[+3] - move right b units 146 right4 b[+4] - move right b units 147 w0 - move right w units 148 w1 b[+1] - move right b units, and set w = b 149 w2 b[+2] - move right b units, and set w = b 150 w3 b[+3] - move right b units, and set w = b 151 w4 b[+4] - move right b units, and set w = b 152 x0 - move right x units 153 x1 b[+1] - move right b units, and set x = b 154 x2 b[+2] - move right b units, and set x = b 155 x3 b[+3] - move right b units, and set x = b 156 x4 b[+4] - move right b units, and set x = b 157 down1 a[+1] - move down a units 158 down2 a[+2] - move down a units 159 down3 a[+3] - move down a units 160 down4 a[+4] - move down a units 161 y0 - move right y units 162 y1 a[+1] - move right a units, and set y = a 163 y2 a[+2] - move right a units, and set y = a 164 y3 a[+3] - move right a units, and set y = a 165 y4 a[+4] - move right a units, and set y = a 166 z0 - move right z units 167 z1 a[+1] - move right a units, and set z = a 168 z2 a[+2] - move right a units, and set z = a 169 z3 a[+3] - move right a units, and set z = a 170 z4 a[+4] - move right a units, and set z = a 171 fnt_num_0 - set current font number (f) = 0 ... 234 fnt_num_63 - set f = 63 235 fnt1 k[1] - set f = k 236 fnt2 k[2] - set f = k 237 fnt3 k[3] - set f = k 238 fnt4 k[+4] - set f = k 239 xxx1 k[1] x[k] - special string x with k bytes 240 xxx2 k[2] x[k] - special string x with k bytes 241 xxx3 k[3] x[k] - special string x with k bytes 242 xxx4 k[4] x[k] - special string x with (unsigned) k bytes 243 fnt_def1 k[1] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k 244 fnt_def2 k[2] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k 245 fnt_def3 k[3] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k 246 fnt_def4 k[+4] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k 247 pre i[1] num[4] den[4] mag[4] k[1] x[k] - begin preamble 248 post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2] - begin postamble 249 post_post q[4] i[1] 223 ... 223 - end postamble 250 - undefined ... 255 - undefined In bop: c0[+4] ... c9[+4] = page counters, \`a la TeX. p[+4] = pointer to previous bop (its byte address); first bop has p = -1 . In the font definitions: c[4] = check sum for TFM file. s[4] = scale factor, in DVI units. d[4] = design size, in DVI units. a[1] = length of the "area" or directory. l[1] = length of the font name. n[a+l] = area and font name string(s). In the preamble: i[1] = DVI format ID = 2, except TeX-XeT has 3. num[4] = numerator of 100 nm / DVI unit. den[4] = denominator of 100 nm / DVI unit. mag[4] = 1000 * magnification. k[1] = comment length. x[k] = comment string. In the postamble: p[4] = pointer to final bop. num[4], den[4], mag[4] = duplicates of values in preamble. l[4] = height-plus-depth of tallest page, in DVI units. u[4] = width of widest page, in DVI units. s[2] = maximum stack depth needed to process this DVI file. t[2] = total number of pages (bop commands) present. In the post-postamble: q[4] = pointer to the "post" command that started the postamble. i[1] = DVI format ID, as in the preamble. 223 ... 223 = at least four "223" bytes. --------------- EOF ``dvi.doc'' ---------------