PdfTextRun class
One run of text from a single show-text operator.
Constructors
-
PdfTextRun({required String text, required PdfMatrix transform, required PdfColor color, required double width, PdfGradient? gradient, String? fontName, double fontSize = 0, List<
PdfGlyphPlacement> ? glyphs, bool invisible = false, bool fill = true, PdfColor? strokeColor, double strokeWidth = 0, double letterSpacing = 0, double wordSpacing = 0, double? visibleWidth, double leadingSpace = 0, int? mcid}) -
const
Properties
- color → PdfColor
-
final
- fill → bool
-
Whether the glyphs are filled (text rendering modes 0/2/4/6). False for
stroke-only modes (1/5) and when a fill that can't be represented (an
unrenderable tiling-pattern fill on a substituted font) is dropped in
favour of the stroke. color/gradient describe the fill.
final
- fontName → String?
-
The /BaseFont name, e.g.
ABCDEF+Helvetica-Bold.final - fontSize → double
-
Nominal font size before transformation, for font selection heuristics.
final
-
glyphs
→ List<
PdfGlyphPlacement> ? -
Real glyph outlines from the embedded font, when available. Devices
should prefer these over substituted text rendering.
final
- gradient → PdfGradient?
-
Shading-pattern fill for this run, already resolved into page space.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasOutlines → bool
-
no setter
- invisible → bool
-
Render mode 3 (§9.4.3): the run paints nothing but still occupies
its geometry - the OCR text layer of scanned documents. Painting
devices must skip it; text extraction wants it like any other run.
final
- leadingSpace → double
-
Advance in em units from the run origin to the start of the first
non-whitespace glyph - the leading-whitespace advance (a leading space
carrying a large Tw is a common way tabular content reaches its column).
A substituting device draws its trimmed text shifted right by this much,
because the layout engines it measures against also drop leading
whitespace and would otherwise place the first visible glyph at the origin.
transform itself keeps the untrimmed origin, so extraction is unaffected.
final
- letterSpacing → double
-
Character spacing (Tc, §9.3.2) in em units - the extra advance added after
every glyph. A device substituting a system font should reproduce it as
real tracking so the substitute's own advances match width instead of
stretching the glyph shapes to fill it.
final
- mcid → int?
-
The marked-content id (/MCID) of the innermost tagged marked-content
sequence enclosing this run, or null when the run is untagged. In a
Tagged PDF this ties the run to a structure element (§14.7).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeColor → PdfColor?
-
Stroke colour for text rendering modes that stroke the glyph outline
(1 stroke, 2 fill+stroke, 5/6 the same plus clip); null when the mode
doesn't stroke. Painting devices outline the glyphs in this colour.
final
- strokeWidth → double
-
Stroke line width in page space (the current line width mapped through
the CTM, like every other stroke); 0 means the thinnest renderable line.
final
- text → String
-
Best-effort Unicode (via ToUnicode CMaps or the font's encoding).
final
- transform → PdfMatrix
-
Maps em-space (origin at the baseline start, 1.0 = the font size) to
page space. Includes font size, horizontal scaling, and rise.
final
- visibleWidth → double?
-
Advance in em units up to the end of the last non-whitespace glyph -
width minus any trailing-whitespace advance. Null means "same as
width" (no trailing whitespace, or the emitter didn't distinguish).
final
- width → double
-
Advance width in em units, from the PDF's font metrics. Devices should
scale their substituted font's output to match, so columns line up. This
total already includes the character/word spacing described by
letterSpacing/wordSpacing.
final
- wordSpacing → double
-
Word spacing (Tw, §9.3.3) in em units - the extra advance added after each
single-byte space (code 32) on a simple font; 0 for composite (CID) fonts,
which Tw never touches. Like letterSpacing, a substituting device should
apply it as real spacing so a space carrying a large Tw opens a genuine gap
rather than stretching the surrounding glyphs across it.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited