Important for all Apple Printing and Graphics Developers:
The information in this Technical Q & A is still relevant up to and including
Mac OS 7.6
with QuickDraw GX 1.1.5. Beginning with the release of Mac OS 8.0,
however, Apple plans to deliver a system which incorporates QuickDraw GX
graphics and typography only. QuickDraw GX printer drivers and GX printing
extensions will not be supported in Mac OS 8.0 or in future Mac OS releases. Apple's
goal is to simplify the user experience of printing by unifying the Macintosh
graphic and printing architectures and standardizing on the classic Printing
For details on Apple's official announcement, refer to
Q: I used the SDK Custom Dialogs sample driver as the basis for the compatibility
part of our GX PostScript driver, and I added an Options dialog to it for our
printer-specific features. I have two problems with it when using applications
that aren't GX-aware:
- For non-GX-aware applications, the page size always is defaults to the fifth paper size. As a result, whichever paper type is the fifth one listed in the resource file that has the
'ptyp's in it becomes the default paper size in the GX compatibility driver. This is, of course, reflected in the Page Setup dialog.
- The driver always defaults to having the "Print To File" checkbox on.
What can I do about these problems?
A: Both of these quirks in the sample driver that you describe (improper default
paper type and the "Print to File" check box defaulting to on) can be fixed by
'PREC' 0 resource in the driver.
When an old-style-printing application calls
PrintDefault() to request the
default old-style print record from the current printer driver, the driver
gives it the contents of the
'PREC' 0 resource. Then, when the application
PrStlDialog(), it passes in that print record. In its
overrides, the GX printer driver interprets the contents of the
old-style-printrecord in order to set up the states of the button, checkboxes,
etc. in the old-style dialogs.
To determine which paper type radio button to select in the old-style page-setup
dialog, QuickDraw GX compares the page rect of the old-style-printrecord to the
rects of all the paper types in the driver (or paper-type extensions, such as
"3-Hole Punch"), and tries to find the best match. Because of the way that the
old-style-printrecord in the
CustomDialogs sample is defined, that best match
turns out to be the fifth paper type in your list. So, to fix this quirk, all
you have to do is change the bounds setting in the
'PREC' 0 resource so that it
matches the bounds of the US Letter paper type in the driver.
To determine the state of the "Print to disk" checkbox, the driver looks at the
UIOffset bit of the old-style-printrecord. (One might not think to look at this
bit, but old-style-printrecords are limited to 120 bytes, and there was no
better place for this driver to store this information.) Because the
resource in this driver has this bit set, the checkbox defaults to on. So, to
fix this quirk, all you have to do is set this bit off.