TextFragmentState

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 项。

属性

名称类型访问描述
BackgroundColorColor?读写在片段文字后面应用的背景填充。
CharacterSpacingfloat读写文本空间单位中的字符间距 (Tc)。
CoordinateOriginCoordinateOrigin读写定位时是否将 Y 视为基线或下行部。
FontSizefloat读写字体大小(单位为点)。
FontStyleFontStyles读写字体样式标志(粗体 / 斜体)。
ForegroundColorColor?读写填充(非描边)颜色应用于已渲染的字形。
FormattingOptionsTextFormattingOptions读写文本格式化选项(换行模式、行间距模式等)。
HorizontalAlignmentHorizontalAlignment读写片段文本的水平对齐方式。
HorizontalScalingfloat读写水平扩展百分比(默认 100)。
Invisiblebool读写文本是否以不可见方式渲染(渲染模式 3)。
LineSpacingfloat读写行间距(leading)以文本空间单位计。
RenderingModeTextRenderingMode读写字形渲染模式(填充 / 描边 / 剪裁)。
Rotationdouble读写旋转角度(单位:度)。
StrikeOutbool读写文本是否带有删除线。
StrokingColorColor?读写描边(轮廓)颜色。
Subscriptbool读写文本是否为下标。
Superscriptbool读写文本是否为上标。
Underlinebool读写文本是否带下划线。
WordSpacingfloat读写文字间距(Tw)以文本空间单位表示。
FontAspose.Pdf.Text.Font?读写用于渲染该片段的字体。
DrawTextRectangleBorderbool读写为 true 时,会在文本边界框周围绘制矩形边框。
TabStopsTabStops读取制表位设置继承自所属片段。
FontNamestring?读写获取或设置字体名称。
TextXIndentfloat读取该状态所属文本在页面上的起始 X(点)位置。
TextHeightfloat读取文本高度(单位为点):(上升值 +
IsBoldbool读写字体是否为粗体。
IsItalicbool读写字体是否为斜体。
IsUnderlinebool读写文本是否带下划线。
IsStrikeOutbool读写文本是否带删除线。
IsSuperscriptbool读写文本是否为上标。
IsSubscriptbool读写文本是否为下标。
TabTagstring读取在渲染的文本中插入的字符串标记,用于替代制表符字符。
TextRisedouble读写文字上移(上标/下标偏移)。
FontDataFontData?读写用于嵌入的外部字体数据(通过 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)。

另请参阅

 中文