ArticleslgStudy

computer science

Device independent file format

Device independent file format is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Device independent file format rather than just read about it. In short: The device independent file format (DVI) is the output file format of the TeX typesetting program, designed by David R. Fuchs in 1979.

Device independent file format — main illustration
Device independent file format — illustration

Key takeaways

  • Device independent file format belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Device independent file format to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Device independent file format from memory before moving on to harder problems.

Reference excerpt

The device independent file format (DVI) is the output file format of the TeX typesetting program, designed by David R. Fuchs in 1979. Unlike the TeX markup files used to generate them, DVI files are not intended to be human-readable; they consist of binary data describing the visual layout of a document in a manner not reliant on any specific image format, display hardware or printer. DVI files are typically used as input to a second program (called a DVI driver) which translates DVI files to graphical data. For example, most TeX software packages include a program for previewing DVI files on a user's computer display; this program is a driver. Drivers are also used to convert from DVI to popular page description languages (e.g. PostScript, PDF) and for printing. TeX markup may be at least partially reverse-engineered from DVI files, although this process is unlikely to produce high-level constructs identical to those present in the original markup, especially if the original markup used high-level TeX extensions (e.g. LaTeX). DVI differs from PostScript and PDF in that it does not support any form of font embedding, instead merely referencing external font names. (Both PostScript and PDF formats can embed their fonts inside the documents.) For a DVI file to be printed or even properly previewed, the fonts it references must be already installed. Also, like the PDF document format, DVI uses a limited sort of “programming” language (in the case of DVI, “a machine-like language”), where termination guarantees that it is not a full, Turing-complete programming language like PostScript. As of 2004 there is a compilation of the specifications a DVI driver must implement by the "TUG DVI Driver Standards Committee". It seems to be based on a TUGboat article of the same name from 1992, but which is much shorter. These documents do not specify the endianness, which is however big endian, as can be seen looking into a DVI file itself.

Specification The DVI format was designed to be compact and easily machine-readable. Toward this end, a DVI file is a sequence of commands which form "a machine-like language", in Knuth's words. Each command begins with an eight-bit opcode, followed by zero or more bytes of parameters. For example, an opcode from the group 0x00 through 0x7F (decimal 127), set_char_i, typesets a single character and moves the implicit cursor right by that character's width. In contrast, opcode 0xF7 (decimal 247), pre (the preamble, which must be the first opcode in the DVI file), takes at least fourteen bytes of parameters, plus an optional comment of up to 255 bytes. In a broader sense, a DVI file consists of a preamble, one or more pages, and a postamble. Six state variables h, v, w, x, y, and z are maintained as signed 32-bit integers, where h and v are the current horizontal and vertical offsets from the upper-left corner (increasing v moves down the page), w and x hold horizontal space values, and y and z hold vertical space values. These variables can be pushed to or popped from the stack. In addition, the current font f is held as an integer value, but is not pushed and popped with the rest of the state variables when the opcodes push or pop are encountered. Font spacing information is loaded from TFM files. The fonts themselves are not embedded in the DVI file, only referenced by an integer value defined in the relevant fnt_defi op. (This is done exactly twice for each loaded font: once before it is referenced, and once in the postamble.) f contains an integer value of up to four bytes in length, though in practice, TeX only ever outputs font numbers in the range 0 through 255. Similarly, the DVI format supports character codes up to four bytes in length, even though only the 0–255 range is commonly seen, as the TFM format is limited to that range. Character codes in DVI files refer to the character encoding of the current font rather than that of the system processing it. This means, for instance, that an EBCDIC-based system can process a DVI file that was generated by an ASCII-based system, so long as it has the same fonts installed.

Graphics as specials The DVI format does not have support for graphics except for the most basic black-and-white boxes. Instead DVI has a general escape/extension mechanism, known as specials (expressed by the \special command in TeX), which defers graphics (and color) to post-processing filters. There are numerous DVI specials, the most notable of which are PostScript specials, but other programs like tpic have their own.

DVI related software DVI files are often converted into PDF, PostScript, or PCL format for reading and printing. They can be also viewed directly by using DVI viewers.

DVI viewers: YAP (included in MiKTeX), xdvi, windvi, Evince, KDVI, Okular, dviout, dviwin, DView (included in the commercial BaKoMa TeX distribution), javaDVI, MDVI, and DVIWindo (of the now defunct commercial Y&Y TeX, which has been open-sourced). DVI to human-readable format: dvitype (disassembler of sorts) DVI-to-PDF converters: dvipdf, dvipdfm, dvipdfmx DVI-to-PS converters: dvips is the de facto standard. CTAN includes some older ones like dvitops (and DVIPSONE) with a note that they lost their market share a long time ago. DVI-to-bitmap converters: dvipng (generates GIF or PNG), or use dvips and Ghostscript DVI-to-SVG converters: dvisvg, dvisvgm, dvi2svg; As of 2014 the only one included in CTAN and actively maintained is dvisvgm. The first DVI previewers capable of on-screen previewing and modification of LaTeX documents ran on Amigas.

… excerpt ends here. Continue reading the full article.

Illustrations

Device independent file format illustration

Worked examples

Example 1 — a first encounter with Device independent file format

Start with the simplest possible case. Write down what Device independent file format claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Device independent file format before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Device independent file format ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Device independent file format

In research
Device independent file format appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Device independent file format in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Device independent file format is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer file formats, Open formats, Page description languages, so understanding it makes those chapters shorter.
In everyday life
Look for Device independent file format outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Device independent file format” →

How to study Device independent file format in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Device independent file format means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Device independent file format out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Device independent file format in simple terms?

The device independent file format (DVI) is the output file format of the TeX typesetting program, designed by David R. Fuchs in 1979.

Why does Device independent file format matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Device independent file format?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Device independent file format.

Tags

  • Computer file formats
  • Open formats
  • Page description languages
  • TeX

Keep exploring