Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 6 - Script Manager / Script Manager Reference
Routines / Replacing a Script System's Default Routines


SetScriptQDPatchAddress

The SetScriptQDPatchAddress procedure replaces the WorldScript I specified QuickDraw patch--or the built-in QuickDraw call--for the given script.

PROCEDURE SetScriptQDPatchAddress (trapNum: Integer;
                                   before: Boolean;
                                   forPrinting: Boolean;
                                   routineAddr: Ptr;
                                   script: ScriptCode);
trapNum
A value that specifies the name of the QuickDraw routine that is to
be replaced.
before
A Boolean that specifies which of two routines is to be replaced. If
TRUE, the WorldScript I patch of the QuickDraw routine is replaced.
If FALSE, the original routine (usually the built-in QuickDraw routine)
is replaced.
forPrinting
A Boolean that specifies whether the replacement routine is for printing. If TRUE, the new QuickDraw patch is specifically for printing; if FALSE, the new QuickDraw patch is not specifically for printing.
routineAddr
A pointer to the routine that is to replace the existing QuickDraw routine.
script
The numeric code that specifies the script system whose dispatch table contains the pointers to the QuickDraw routines. Constants for all defined script codes are listed on page 6-52.
DESCRIPTION
The SetScriptQDPatchAddress procedure replaces the pointer to the desired routine in the specified script's dispatch table.

All of the WorldScript I patches call the original QuickDraw routine after they execute. Each element in the dispatch table consists of a pair of addresses: one for the WorldScript I patch, and another for the original (built-in QuickDraw) version of the routine. With SetQDPatchAddress you can replace either routine. Thus you can insert your patch code either before (or in place of) the WorldScript I QuickDraw patch, or before (or in place of) the original QuickDraw routine.

Some printers perform their own text layout on text that is passed to them. Therefore, each QuickDraw patch has two entry points: one for screen display and one for printing only. By specifying either TRUE or FALSE in the forPrinting parameter, you specify whether you are passing the "for printing only" or the "not for printing only" entry point. For example, some script systems might use the "for printing only" entry point to perform extra-fine justification of text on a PostScript printer.

IMPORTANT
When you patch a script system's QuickDraw call, you alter that script's behavior for as long as it remains enabled. Therefore, be sure to restore the pointer to its original state whenever your application quits or is switched out by the Process Manager.
Valid values for the trapNum parameter are listed on page 6-101.

SEE ALSO
WorldScript I is described in the appendix "Built-in Script Support" in this book.

In order to handle contextual formatting appropriately for each script system, printer drivers should call the Script Manager's print action routine, described in Inside Macintosh: Devices.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996