9.4.2 Text-Positioning Operators

Text space is the coordinate system in which text is shown. It shall be defined by the text matrix, Tm, and the text state parameters Tfs, Th, and Trise, which together shall determine the transformation from text space to user space. Specifically, the origin of the first glyph shown by a text-showing operator shall be placed at the origin of text space. If text space has been translated, scaled, or rotated, then the position, size, or orientation of the glyph in user space shall be correspondingly altered.

 

文本空间是用来显示文本的坐标系系统,它由文本矩阵Tm和文本状态参数Tfs,Th,Trise共同决定的,我们可以得用这些文本操作符和参数将文本空间映射到用户空间(我觉得用户空间应该就是指我们所看到的屏幕空间)。特别需要指出的是,由文本显示操作符显示的第一个字形的原点应该放置在文本空间的原点处。当文本空间被转换、放缩、旋转时,用户空间中字形的位置、大小和方向也应该相应发生改变。

 

PS:对于文本空间如何理解?我认为PDF中一页文件由若干个文本空间组成,一个文本空间就是一个文本对象(即以BT和ET为标识符的整块内容区域),这个文本空间的第一个字符的位置是相对于整个页面空间的绝对位置,而它之后的字符则是相对于它的相对位置。

 

The text-positioning operators shall only appear within text objects.

文本位置操作符只能出现在文本对象当中。

 

Table 108 – Text-positioning operators

表108-文本位置操作符

Td

 operands tx ty 

Move to the start of the next line, offset from the start of the current line by (tx, ty). tx and ty shall denote numbers expressed in unscaled         text space units. More precisely, this operator shall perform these assignments:

 

Td用来表示移动到下一行,其相对于当前行开始位置的偏移地址由tx,ty来标识。(Td操作符有两个操作数tx,ty,第二个操作数用来标识当前行相较于文本空间原点的绝对偏移量。)tx,ty用的是原始的未经放缩的文本空间的大小单位。

 

TD

operands tx ty

Move to the start of the next line, offset from the start of the current line by (tx, ty). As a side effect, this operator shall set the leading parameter in the text state. This operator shall have the same effect as this code:
−ty TL
tx ty Td

 TD也是用来指示移动到下一行,与Td类似。另一方面,TD也还要设置TL,即leading parameter.

At the beginning of a text object, Tm shall be the identity matrix; therefore, the of text space shall be initially the same as that of user space. The text-positioning operators, described in Table 108, alter Tm and thereby control the placement of glyphs that are subsequently painted. Also, the text-showing operators, described in Table 109, update Tm (by altering its e and f translation components) to take into account the horizontal or vertical displacement of each glyph painted as well as any character or word-spacing parameters in the text state.

 在文本对象开始的时候,Tm应该是一个单位矩阵。因此,文本空间应被初始化为和用户空间一致。在表108中罗列的文本位置操作符通过修正Tm以控制后面将要显示的字形的位置。同样的,与文本空间的任意字符或者词间距参数类似,在表109中罗列的文本显示操作符通过修改Tm的转换参数e,f以把每个显示的字形的水平或者垂直位移考虑进来。

Tm

operands a b c d e f
Set the text matrix, Tm, and the text line matrix, Tlm:

The operands shall all be numbers, and the initial value for Tm and Tlm shall be the identity matrix, [1 0 0 1 0 0]. Although the operands specify a matrix, they shall be passed to Tm as six separate numbers, not as an array.
The matrix specified by the operands shall not be concatenated onto the current text matrix, but shall replace it.

 设置文本矩阵或文本行矩阵。该操作符的全部操作数都是数字,还且其初始值应为单位矩阵[1 0 0 1 0 0]. 尽管由操作数可以确定一个矩阵,但是当它们传递给Tm的时候应该是6个独立的数字,而不是一个数组。

由操作数决定的矩阵不能同当前的文本矩阵链接到一起,而是取代它。

 

T*
Move to the start of the next line. This operator has the same effect as the code
0 -Tl Td
where Tl denotes the current leading parameter in the text state. The negative of Tl is used here because Tl is the text leading expressed as a positive number. Going to the next line entails decreasing the y coordinate.

 


Additionally, within a text object, a conforming reader shall keep track of a text line matrix, Tlm, which captures the value of Tm at the beginning of a line of text. The text-positioning and text-showing operators shall read and set Tlm on specific occasions mentioned in Tables 108 and 109.
NOTE This can be used to compactly represent evenly spaced lines of text.

此外,在读取一个文本对象时,阅读器应该记录一个文本行矩阵,Tlm,它在一行文本的开头从Tm取得值。文本位置操作符和文本显示操作符会在表108和表109中所提到的时机读取、设置Tlm。

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值