Graphics Programs Reference
In-Depth Information
As an example, we return to the “Hello, World!” file from Chapter 2 :
1. 0. 0. 1. 50. 700. cm Position at (50, 700)
BT Begin text block
/F0 36. Tf Select /F0 font at 36pt
(Hello, World!) Tj Place the text string
ET End text block
Here, we've used the Tf operator with font name and size operators to select the font,
and the Tj operator to show a text string. We have relied on the graphics operator cm
to position the text. Now, we will discuss other methods of changing the text position.
Text Space and Text Positioning
Text space is the coordinate system in which text is defined. The transformation from
this text space into user space (and then into device space, as usual) determines where
text is placed on the page. The origin of the first glyph in the text string is placed at the
origin of text space.
There are two matrices to consider:
• The text matrix , which defines the current transformation for the next glyph. It is
altered by the text positioning and text showing operators.
• The text line matrix , which is the state of the text matrix at the beginning of the
current line. Thus, lines of text may be aligned vertically by the use of an operator
to move to the next line, without manually keeping track of the position of the start
of the line.
These matrices do not persist from text section to text section, but are reset to the
identity matrix at the beginning of each text section. Together with the font size, hor-
izontal scaling, and text rise, these two matrices define the transformation from text
space to user space.
The operators for modifying the text position are summarized in Table 6-2 .
Table 6-2. Operators for positioning text
Operands
Operator
Function
x , y
Td
Move the text position to the next line, offset by ( x , y ). The parameters are expressed in unscaled
text space units.
x , y
TD
Move the text position to the next line, offset by ( x , y ). Sets the leading to -y . The parameters are
expressed in unscaled text space units.
-
T*
Move the text position to the next line. Equivalent to the sequence 0 leading Td (where leading is
the current text leading).
a , b , c , d , e , f
Sets the text matrix and text line matrix to [a b 0 c d 0 e f 1] . Unlike the graphics matrix
operator cm , the matrix replaces the current matrix, rather than being concatenated with it.
Tm
Search WWH ::




Custom Search