1.2.1.5 Master Units
Most printers support commands with a variety of resolutions. For example,
the Immediate Line Feed command on the Kodak Diconix printer provides a
resolution of 1/288th of an inch while the same printer supports
vertical-graphics resolutions of 1/96th of an inch. To simplify the problem
of handling various resolutions, the Universal Printer Driver uses a
single, common coordinate system. The units in this coordinate system are
called master units. Master units are the least common multiple of the
various horizontal and vertical resolutions supported by the printer. (For
more information about master units, how they are computed, and how they
are specified, see Chapter 3, Specifying Master Units and Minidriver Data.)
Converting Master Units
The Universal Printer Driver calculates the arguments for some printer
commands by adding a value to the specified master units, multiplying the
specified master units by a value, or dividing the specified master units
by a value. For example, in the case of the Kodak Diconix printer, the
vertical master unit is 1/576 of an inch; however, the printer's immediate
line-feed command operates in 1/288 inch increments. When using this
command, the Universal Printer Driver must convert the argument it supplies
from vertical master units to the required units.
UniTool stores each printer command in a Command Descriptor (CD) data
structure. In cases where the Universal Printer Driver will need to supply
an argument to a particular command, such as the Immediate Line Feed
command, UniTool stores additional data in an Extended Command-Descriptor
(EXTCD) data structure. This data structure contains values by which the
Universal Printer Driver should divide, multiply, increase, or limit
command arguments. A special Units dialog box is provided for each printer
command. In those cases where the Universal Printer Driver must convert
master units, specify the appropriate values in the corresponding Units
dialog box. In the case of the Immediate Line Feed command, master units
must be divided by 2 prior to setting the parameter, therefore the sUnitDiv
control contains the value 2 as shown in the following illustration:
bitmap: extcd
The sMax control contains the value 255 (the maximum allowable value for
this parameter) and the sMin control contains the value 1 (the minimum
allowable value for this parameter).
Once you've read this chapter and understand the fundamental concepts of
developing a minidriver, you're ready to set up the development
environment. The next chapter, Getting Started, explains how this is done.