Important: The information in this document is obsolete and should not be used for new development.
GetFormatOrder
TheGetFormatOrderprocedure determines the display order of multiple style runs with mixed directions.
PROCEDURE GetFormatOrder (ordering: FormatOrderPtr; firstFormat: Integer; lastFormat: Integer; lineRight: Boolean; rlDirProc: Ptr; dirParam: Ptr);
ordering- A pointer to a format order array. Upon completion of the call, the format order array contains the numbers identifying the style runs in display order. This is its type declaration:
TYPE
FormatOrder = ARRAY [0..0] OF Integer;
FormatOrderPtr = ^FormatOrder;
firstFormat- A number greater than or equal to 0 identifying the first style run in storage order that is part of the line for which you are calling
GetFormatOrder.lastFormat- A number greater than or equal to 0 identifying the last style run in storage order that is part of the line for which you are calling
GetFormatOrder.lineRight- A flag that you set to
TRUEif the primary line direction is right-to-left.rlDirProc- A pointer to an application-supplied function that calculates the correct direction, given the style run identifier. The GetFormatOrder procedure calls the application-defined
rlDirProcfunction for each identifier fromfirstFormattolastFormat. The interface to this function looks
like this:FUNCTION MyRlDirProc(theFormat: Integer;
dirParam: Ptr ): Boolean;
- This function returns
TRUEfor right-to-left text direction andFALSEfor left-to-right. GivendirParamand a style run identifier, the application-definedrlDirProcroutine should be able to determine the style run direction.theFormat- A number identifying the style run and its associated attribute information in the information block pointed to by
dirParam.dirParam- A pointer to a parameter block that contains the font and script information for each style run in the text. This parameter block is used by the application-supplied routine.
DESCRIPTION
TheGetFormatOrderprocedure helps you determine how to draw text that contains multiple style runs with mixed directions. For mixed-directional text, after you determine where to break the line, you need to callGetFormatOrderto determine the display order. When you callGetFormatOrder, you supply a Boolean function, and reference it using therlDirProcparameter. This function calculates the direction of each style run identified by number. Do not callGetFormatOrderif there is only one style run on the line.You must index the style runs in storage order. You pass
GetFormatOrdernumbers identifying the first and last style runs of the line in storage order and the primary line direction. TheGetFormatOrderprocedure returns to you an equivalent sequence in display order.If you do not explicitly define the primary line direction of the text, base the
lineRightparameter on the value of theSysDirectionglobal variable. (TheSysDirectionglobal variable is set to-1if the system direction is right to left, and 0 if the system direction is left to right.)The
orderingparameter points to an array of integers, with (lastFormat - firstFormat + 1) entries. TheGetFormatOrderprocedure fills an array (the size of the number of the style runs) with the display order of each style run. On exit, the array contains a permuted list of the numbers fromfirstFormattolastFormat. The first entry in the array is the number of the style run to draw first; this is the leftmost style run in display order. The last entry in the array is the number of the entry to draw last, the rightmost style run in display order. For more information about how to use theGetFormatOrderprocedure, see "Determining the Display Order for Style Runs," which begins on page 3-33. For more information about therlDirProcfunction, see "Application-Supplied Routine" on page 3-97.