Important: The information in this document is obsolete and should not be used for new development.
Routines
This section describes the routines that you use to set the text characteristics of the graphics port drawing environment, measure and draw text, lay out lines of text, and determine where to position the caret and which glyphs to highlight in a range of text. It also describes two low-level routines that you can use to measure and draw text.Four parameters that are common to a number of routines are described in detail here. These parameters are also listed and defined briefly in the each routine.
The slop Parameter
TheDrawJustified,MeasureJustified,PixelToChar, andCharToPixel routines take aslopparameter. The value of this parameter is the number of pixels by which the width of the text segment is to be changed, after the text has been scaled. Theslopis a signed value that specifies how much the text is to be extended or condensed. Theslopis derived from the calculations made using the proportion returned from thePortionLinefunction for a style run. To measure or draw text that is not to be extended or condensed, pass aslopvalue of 0.The styleRunPosition Parameter
ThePortionLine,MeasureJustified,DrawJustified,PixelToChar, andCharToPixelroutines take astyleRunPositionparameter. This parameter specifies the position of the style run on the display line, and is used to
The style run position parameter is meaningful only for those script systems that use intercharacter spacing for justification. For all other script systems, the parameter exists for future extensibility. Although the style run position parameter is not used, for example, for justifying text in the Roman script system, to allow for future compatibility, you should always specify the appropriate value for it for all calls that take it.
- determine the proportion of total slop to apply to a style run
- measure or draw a line of justified text
- identify where to break a line of text
- determine the caret position to mark an insertion point or highlight text.
For those script systems that do use intercharacter spacing, space between style runs may be allocated differently depending upon whether the style run is leftmost, rightmost, or between two other style runs. For example, depending on the script system, if a style run occurs at the beginning or end of a line, extra space may not be added to the outer edge of the outermost glyph, whereas if a style run is interior to a line, all of the glyphs of the text may be treated the same: extra space is allocated to both sides of every glyph including those at either end of the style run.
Use one of the following constants (defined as type
- Note
- The current implementations of simple script systems such as Roman and Cyrillic do not justify a line of text by changing the width of nonspace characters. Instead, they rely solely on the use of space characters: the same amount of extra width is added to (or subtracted from) every space whether the space is at the beginning or end of the line or interior to it.
![]()
JustStyleCode) in
thestyleRunPositionparameter.The numer and denom Parameters
ThePortionLine,DrawJustified,MeasureJustified,PixelToChar,CharToPixel,StdText, andStdTxMeasroutines takenumeranddenomparameters. Bothnumeranddenomare point values:numerspecifies the numerator for the horizontal and vertical scaling factors, anddenomspecifies the denominator for
the horizontal and vertical scaling factors. Together, these values specify the scaling factors for the text:numer.voverdenom.vgives the vertical scaling (height), andnumer.hoverdenom.hgives the horizontal scaling factors (width). For routines that take these parameters, you need to specify values fornumeranddenomeven if you are not scaling the text. For unscaled text, you can specify scaling factors of 1, 1.For all routines except
StdTxtMeasthat take these parameters,numeranddenomare input parameters only. ForStdTxtMeas,numeranddenomare reference parameters. On output, these parameters contain additional scaling to be applied to the text. Use of the output values is explained in the description of "StdTxMeas" on page 3-96.
Subtopics
- The slop Parameter
- The styleRunPosition Parameter
- The numer and denom Parameters
- Setting Text Characteristics
- Drawing Text
- Measuring Text
- Laying Out a Line of Text
- Determining the Caret Position, and Selecting and Highlighting Text
- Low-Level QuickDraw Text Routines