9.4.2 Text-Positioning Operators

本文介绍了PDF文档中的文本空间概念及其核心元素,包括文本矩阵Tm和文本状态参数Tfs、Th、Trise的作用。详细解释了如何利用这些元素将文本空间映射到用户空间,并探讨了文本位置操作符如Td、TD等的功能及使用场景。

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。

 

 

先看效果: https://renmaiwang.cn/s/jkhfz Hue系列产品将具备高度的个性化定制能力,并且借助内置红、蓝、绿三原色LED的灯泡,能够混合生成1600万种不同色彩的灯光。 整个操作流程完全由安装于iPhone上的应用程序进行管理。 这一创新举措为智能照明控制领域带来了新的启示,国内相关领域的从业者也积极投身于相关研究。 鉴于Hue产品采用WiFi无线连接方式,而国内WiFi网络尚未全面覆盖,本研究选择应用更为普及的蓝牙技术,通过手机蓝牙与单片机进行数据交互,进而产生可调节占空比的PWM信号,以此来控制LED驱动电路,实现LED的调光功能以及DIY调色方案。 本文重点阐述了一种基于手机蓝牙通信的LED灯设计方案,该方案受到飞利浦Hue智能灯泡的启发,但考虑到国内WiFi网络的覆盖限制,故而选用更为通用的蓝牙技术。 以下为相关技术细节的详尽介绍:1. **智能照明控制系统**:智能照明控制系统允许用户借助手机应用程序实现远程控制照明设备,提供个性化的调光及色彩调整功能。 飞利浦Hue作为行业领先者,通过红、蓝、绿三原色LED的混合,能够呈现1600万种颜色,实现了全面的定制化体验。 2. **蓝牙通信技术**:蓝牙技术是一种低成本、短距离的无线传输方案,工作于2.4GHz ISM频段,具备即插即用和强抗干扰能力。 蓝牙协议栈由硬件层和软件层构成,提供通用访问Profile、服务发现应用Profile以及串口Profiles等丰富功能,确保不同设备间的良好互操作性。 3. **脉冲宽度调制调光**:脉冲宽度调制(PWM)是一种高效能的调光方式,通过调节脉冲宽度来控制LED的亮度。 当PWM频率超过200Hz时,人眼无法察觉明显的闪烁现象。 占空比指的...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值