TextFragmentState
概述
TextFragmentState 是 Aspose.PDF FOSS 中用于 .NET 的一个类。继承自:TextState。
片段级文本格式化状态。
该类提供 12 种方法,用于在 .NET 程序中处理 TextFragmentState 对象。可用的方法包括:ApplyChangesFrom、IsFitRectangle、MeasureHeight、MeasureString、TextFragmentState、TextState。在安装了面向 .NET 的 Aspose.PDF FOSS 包后,所有公共成员对任何 .NET 应用程序均可访问。属性:BackgroundColor、CharacterSpacing、CoordinateOrigin、DrawTextRectangleBorder、Font、FontData,以及另外 28 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
BackgroundColor | Color? | 读写 | 在片段文字后面应用的背景填充。 |
CharacterSpacing | float | 读写 | 文本空间单位中的字符间距 (Tc)。 |
CoordinateOrigin | CoordinateOrigin | 读写 | 定位时是否将 Y 视为基线或下行部。 |
FontSize | float | 读写 | 字体大小(单位为点)。 |
FontStyle | FontStyles | 读写 | 字体样式标志(粗体 / 斜体)。 |
ForegroundColor | Color? | 读写 | 填充(非描边)颜色应用于已渲染的字形。 |
FormattingOptions | TextFormattingOptions | 读写 | 文本格式化选项(换行模式、行间距模式等)。 |
HorizontalAlignment | HorizontalAlignment | 读写 | 片段文本的水平对齐方式。 |
HorizontalScaling | float | 读写 | 水平扩展百分比(默认 100)。 |
Invisible | bool | 读写 | 文本是否以不可见方式渲染(渲染模式 3)。 |
LineSpacing | float | 读写 | 行间距(leading)以文本空间单位计。 |
RenderingMode | TextRenderingMode | 读写 | 字形渲染模式(填充 / 描边 / 剪裁)。 |
Rotation | double | 读写 | 旋转角度(单位:度)。 |
StrikeOut | bool | 读写 | 文本是否带有删除线。 |
StrokingColor | Color? | 读写 | 描边(轮廓)颜色。 |
Subscript | bool | 读写 | 文本是否为下标。 |
Superscript | bool | 读写 | 文本是否为上标。 |
Underline | bool | 读写 | 文本是否带下划线。 |
WordSpacing | float | 读写 | 文字间距(Tw)以文本空间单位表示。 |
Font | Aspose.Pdf.Text.Font? | 读写 | 用于渲染该片段的字体。 |
DrawTextRectangleBorder | bool | 读写 | 为 true 时,会在文本边界框周围绘制矩形边框。 |
TabStops | TabStops | 读取 | 制表位设置继承自所属片段。 |
FontName | string? | 读写 | 获取或设置字体名称。 |
TextXIndent | float | 读取 | 该状态所属文本在页面上的起始 X(点)位置。 |
TextHeight | float | 读取 | 文本高度(单位为点):(上升值 + |
IsBold | bool | 读写 | 字体是否为粗体。 |
IsItalic | bool | 读写 | 字体是否为斜体。 |
IsUnderline | bool | 读写 | 文本是否带下划线。 |
IsStrikeOut | bool | 读写 | 文本是否带删除线。 |
IsSuperscript | bool | 读写 | 文本是否为上标。 |
IsSubscript | bool | 读写 | 文本是否为下标。 |
TabTag | string | 读取 | 在渲染的文本中插入的字符串标记,用于替代制表符字符。 |
TextRise | double | 读写 | 文字上移(上标/下标偏移)。 |
FontData | FontData? | 读写 | 用于嵌入的外部字体数据(通过 FontRepository.OpenFont 设置)。 |
方法
| 签名 | 描述 |
|---|---|
TextFragmentState(fragment: TextFragment) | 包装片段的底层状态,使写入能够回流至该状态。 |
ApplyChangesFrom(textState: TextState) | 将 textState 中的所有公共格式属性复制到此状态中。 |
IsFitRectangle(str: string, rect: Rectangle) | 当渲染后的文本在当前字体 / 大小下能够适配提供的矩形时返回 true。 |
MeasureHeight(character: char) | 测量当前字体 / 大小下单个字符的高度,单位为点。 |
MeasureString(str: string) | 测量在当前字体 / 大小下字符串 str 的渲染宽度,单位为点。 |
TextState() | 在此 TextFragmentState 实例上调用 TextState。 |
TextState(fontSize: double) | 在此 TextFragmentState 实例上调用 TextState(fontSize)。 |
TextState(fontFamily: string) | 文本是否有删除线。 |
TextState(fontFamily: string, fontSize: double) | 在此 TextFragmentState 实例上调用 TextState(fontFamily, fontSize)。 |
TextState(fontFamily: string, bold: bool, italic: bool) | 在此 TextFragmentState 实例上调用 TextState(fontFamily, bold, italic)。 |
TextState(foregroundColor: System.Drawing.Color) | 用于渲染该片段的字体。返回基类转换为 ; 设置器 |
TextState(foregroundColor: System.Drawing.Color, fontSize: double) | 在此 TextFragmentState 实例上调用 TextState(foregroundColor, fontSize)。 |