Click or drag to resize
Pdftools logo

TextFragment Class

Text Fragment

A TextElement contains an arbitrary number of text fragments. Text can be partitioned arbibrarily into fragments without respecting word boundaries or reading order.

A text fragment provides iteration over all contained Glyphs. Removing, clearing, adding, and sub-ranges are not supported. While iterating, a CorruptException may be generated if the text fragment contains glyphs with inconsistent Unicode information.

Inheritance Hierarchy
SystemObject
  PdfTools.Toolbox.InternalNativeBase
    PdfTools.Toolbox.InternalNativeObject
      PdfTools.Toolbox.Pdf.ContentTextFragment

Namespace: PdfTools.Toolbox.Pdf.Content
Assembly: PdfTools.Toolbox (in PdfTools.Toolbox.dll) Version: 1.1.0+5820e9ca9ca173983539ffc40abc227fb62e6928
Syntax
C#
public class TextFragment : NativeObject, 
	IList<Glyph>, ICollection<Glyph>, IEnumerable<Glyph>, 
	IEnumerable

The TextFragment type exposes the following members.

Properties
 NameDescription
Public propertyBoundingBox

The bounding box

This is a rectangle that encompasses all parts of the text fragment.
Public propertyCharacterSpacing

The additional spacing between glyphs

When the glyph for each character in the text is rendered, the character spacing is added to the horizontal or vertical component of the glyph's displacement, depending on the writing mode. It is subject to scaling by the horizontal scaling if the writing mode is horizontal.
Public propertyCount 
Public propertyFill This text fragment's parameters for filling the text or if the text is not filled
Public propertyFont

The font

The returned Font can only be used for extraction purposes. Specifically, using this object in TextGenerator(Text, Font, Double, NullablePoint) or in Font results in a ArgumentException error.
Public propertyFontSize

The font size

Public propertyHorizontalScaling

The horizontal scaling factor

The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction. Its value is specified relative to the normal width of the glyphs, with 1 being the normal width.
Public propertyIsReadOnly 
Public propertyItem 
Public propertyRise

The rise of the baseline

The text rise specifies the distance to move the baseline up or down from its default location. Positive values of text rise move the baseline up. Adjustments to the baseline are useful for drawing superscripts or subscripts.
Public propertyStroke This text fragment's parameters for stroking the text or if the text is not stroked
Public propertyText The string painted by this text fragment
Public propertyTransform

The transform to be applied to the bounding box rectangle

Use this transform matrix to compute the actual location of the text fragment's bounding box.
Public propertyWordSpacing

The additional spacing between words

Word spacing works the same way as character spacing, but applies only to the space character, code 32.
Public propertyWritingMode

The writing direction

This is the writing mode for the text fragment. It applies to all contained Glyphs.
Top
Methods
See Also