Appearance
Class: Run ​
One text run (a:r): a span of text with uniform character formatting.
Constructors ​
Constructor ​
new Run(
element,context,inherited):Run
Parameters ​
| Parameter | Type | Description |
|---|---|---|
element | Element | - |
context | TextContext | What the run is read against; see TextContext. Its inherit.fontRef is the tier resolvedColor and resolvedFontFace consult just below the run's own a:rPr and above the placeholder and p:defaultTextStyle chain. |
inherited | InheritedRunProps | null | What the run inherits when it sets no colour, size, face, bold or italic of its own, or null for text that inherits through nothing. Built by the owning Paragraph and shared by its runs; nothing in it is resolved until a run asks. |
Returns ​
Run
Accessors ​
baselinePct ​
Get Signature ​
get baselinePct():
number|null
Baseline shift as a percentage of the font size (a:rPr/@baseline, stored in 1000ths of a percent): positive for superscript (the writer's default is 30), negative for subscript (-40), or null when unset. Reported as the percentage (@baseline ÷ 1000).
@baseline is a:ST_Percentage, a union that also admits "62.5%" — the only form the Strict profile has — so it is read through parsePercentPoints rather than as a bare number.
Returns ​
number | null
bold ​
Get Signature ​
get bold():
boolean|null
Bold (a:rPr/@b), or null when unset (inherited from style).
Returns ​
boolean | null
Set Signature ​
set bold(
value):void
Parameters ​
| Parameter | Type |
|---|---|
value | boolean | null |
Returns ​
void
caps ​
Get Signature ​
get caps():
string|null
Capitalization token (a:rPr/@cap: none | small | all), or null when unset. small renders small-caps, all renders all-caps.
Returns ​
string | null
charSpacingPt ​
Get Signature ​
get charSpacingPt():
number|null
Character spacing (tracking) in points (a:rPr/@spc, authored in hundredths of a point), or null when unset. Negative tightens. The read counterpart of the write-side charSpacing option.
Returns ​
number | null
color ​
Get Signature ​
get color():
string|null
Explicit RGB fill colour as a 6-hex string (a:solidFill/a:srgbClr/@val), or null.
Returns ​
string | null
Set Signature ​
set color(
value):void
Parameters ​
| Parameter | Type |
|---|---|
value | string | null |
Returns ​
void
element_ ​
Get Signature ​
get element_():
Element
Escape hatch: the underlying a:r element. After mutating it call markDirty, or save() writes the original bytes.
Returns ​
Element
fontName ​
Get Signature ​
get fontName():
string|null
Latin typeface name (a:rPr/a:latin/@typeface), or null when unset.
Returns ​
string | null
Set Signature ​
set fontName(
value):void
Parameters ​
| Parameter | Type |
|---|---|
value | string | null |
Returns ​
void
fontSizePt ​
Get Signature ​
get fontSizePt():
number|null
Font size in points (a:rPr/@sz is hundredths of a point), or null if unset.
Returns ​
number | null
Set Signature ​
set fontSizePt(
value):void
Parameters ​
| Parameter | Type |
|---|---|
value | number | null |
Returns ​
void
highlight ​
Get Signature ​
get highlight():
ResolvedColor|null
The run's highlight colour (a:rPr/a:highlight), resolved to a literal hex through the owning slide's theme, or null when the run has no highlight or its colour cannot be made literal. The writer authors highlights from a hex colour, so effectiveHex is that colour; imported decks may carry a theme token.
Returns ​
ResolvedColor | null
hyperlink ​
Get Signature ​
get hyperlink():
Hyperlink|null
The run's click hyperlink (a:rPr/a:hlinkClick), or null when the run carries none. A URL link resolves its @r:id to the external target (Hyperlink.url); a slide jump resolves it to the linked slide's partname (Hyperlink.targetPartName). When the run is read without its part's relationships (see TextContext.rels), only the raw @r:id/@action/@tooltip are reported (the target stays null).
Returns ​
Hyperlink | null
italic ​
Get Signature ​
get italic():
boolean|null
Italic (a:rPr/@i), or null when unset (inherited from style).
Returns ​
boolean | null
Set Signature ​
set italic(
value):void
Parameters ​
| Parameter | Type |
|---|---|
value | boolean | null |
Returns ​
void
resolvedBold ​
Get Signature ​
get resolvedBold():
boolean|null
Whether this run effectively renders bold. It is the run's own @b (bold) when set; otherwise, for a run inside a placeholder, the bold state it inherits from the placeholder/list-style chain (paragraph a:defRPr → slide a:lstStyle → layout → master placeholder a:lstStyle → master p:txStyles). null when the run sets no @b and inherits none — the resolved counterpart of bold, which reports only the run's own value.
Returns ​
boolean | null
resolvedColor ​
Get Signature ​
get resolvedColor():
ResolvedColor|null
The colour this run effectively renders, resolved against the owning slide's theme to a literal hex. It is the run's own solid fill (color/schemeColor) when set; otherwise the shape's p:style/a:fontRef colour, then — for a run inside a placeholder — the colour it inherits from the placeholder/list-style chain (layout → master placeholder a:lstStyle → master p:txStyles), then the presentation's p:defaultTextStyle. null when the run sets no colour and inherits none, or the colour cannot be made literal. null too when the run's own fill is not a solid colour (a:noFill, a gradient): the run decides its own colour then, and the one it would otherwise inherit is not what it paints in, the rule Shape.resolvedFill and TableCell.resolvedFill follow. The returned ResolvedColor carries effectiveHex — the base colour with its child transforms (lumMod/shade/…) applied — for the final rendered colour.
Returns ​
ResolvedColor | null
resolvedFontFace ​
Get Signature ​
get resolvedFontFace():
string|null
The typeface this run effectively renders, resolved to a literal face name. It is the run's own a:latin (fontName) when set; otherwise the face named by the shape's p:style/a:fontRef (idx → theme major/minor font), then — for a run inside a placeholder — the face it inherits from the placeholder/list-style chain, then the presentation's p:defaultTextStyle. A +mj-*/+mn-* major/minor theme-font token — on the run itself or reached through the chain — is resolved through the theme fontScheme to its concrete face. null when the run names no face and inherits none, or a token cannot be resolved — the resolved counterpart of fontName, which reports the raw @typeface (possibly a token).
Returns ​
string | null
resolvedItalic ​
Get Signature ​
get resolvedItalic():
boolean|null
Whether this run effectively renders italic. It is the run's own @i (italic) when set; otherwise, for a run inside a placeholder, the italic state it inherits from the placeholder/list-style chain (paragraph a:defRPr → slide a:lstStyle → layout → master placeholder a:lstStyle → master p:txStyles). null when the run sets no @i and inherits none — the resolved counterpart of italic, and the twin of resolvedBold: @b and @i are siblings a master text style states together, so a deck that can be authored with an inherited italic can be read back with one.
Returns ​
boolean | null
resolvedSizePt ​
Get Signature ​
get resolvedSizePt():
number|null
The point size this run effectively renders. It is the run's own @sz (fontSizePt) when set; otherwise, for a run inside a placeholder, the size it inherits from the placeholder/list-style chain (paragraph a:defRPr → slide a:lstStyle → layout → master placeholder a:lstStyle → master p:txStyles). null when the run sets no size and inherits none — the resolved counterpart of fontSizePt, which reports only the run's own value.
Returns ​
number | null
schemeColor ​
Get Signature ​
get schemeColor():
string|null
Theme colour token when the fill is a scheme colour (a:schemeClr/@val, e.g. accent2), or null.
Returns ​
string | null
Set Signature ​
set schemeColor(
value):void
Throws ​
when the token is not an ST_SchemeColorVal
Parameters ​
| Parameter | Type |
|---|---|
value | string | null |
Returns ​
void
strike ​
Get Signature ​
get strike():
string|null
Strikethrough token (a:rPr/@strike: noStrike | sngStrike | dblStrike), or null when unset (inherited from the style). Surfaced as the raw token — sngStrike is the writer's single-strike value.
Returns ​
string | null
text ​
Get Signature ​
get text():
string
The run's text (a:t), verbatim — whitespace is not normalized.
Returns ​
string
Set Signature ​
set text(
value):void
Parameters ​
| Parameter | Type |
|---|---|
value | string |
Returns ​
void
underline ​
Get Signature ​
get underline():
string|null
Underline style token (a:rPr/@u, e.g. sng), or null when unset.
Returns ​
string | null
Set Signature ​
set underline(
value):void
Throws ​
when the token is not an ST_TextUnderlineType
Parameters ​
| Parameter | Type |
|---|---|
value | string | null |
Returns ​
void
Methods ​
markDirty() ​
markDirty():
void
Mark the owning part dirty so save() reserializes it. Call after mutating element_.
Returns ​
void