Skip to main content

TextSpan

Struct TextSpan 

Source
pub struct TextSpan {
Show 13 fields pub text: String, pub fill: Option<PropertyValue>, pub font_weight: Option<PropertyValue>, pub italic: Option<bool>, pub underline: Option<bool>, pub strikethrough: Option<bool>, pub vertical_align: Option<String>, pub footnote_ref: Option<String>, pub data_ref: Option<String>, pub data_format: Option<DataFormat>, pub highlight: Option<PropertyValue>, pub code: Option<bool>, pub link: Option<String>,
}
Expand description

A text content span — a run of text with optional inline style overrides.

This is deliberately named TextSpan to avoid colliding with the source- location type Span.

Fields§

§text: String

The literal text content.

§fill: Option<PropertyValue>

Per-span fill override (usually a token ref).

§font_weight: Option<PropertyValue>

Per-span font-weight override.

§italic: Option<bool>

Italic override.

§underline: Option<bool>

Underline decoration.

§strikethrough: Option<bool>

Strikethrough decoration.

§vertical_align: Option<String>

Vertical alignment of the span relative to the run baseline. Some("super") raises the span (superscript); Some("sub") lowers it (subscript). Both typeset the span at a reduced font size. None (or any other value) keeps the span on the baseline at full size. See the scene compile_text super/subscript handling for the exact scale + baseline-shift factors.

§footnote_ref: Option<String>

Footnote reference — the id of a page-level FootnoteNode. When Some(id), the renderer emits the referenced footnote’s auto-number as a SUPERSCRIPT marker run immediately AFTER this span’s text (reusing the TextSpan::vertical_align "super" rendering: reduced size + raised baseline). An id that names no footnote on the same page yields an advisory footnote.unresolved_ref and no marker. KDL: footnote-ref="fn.1".

§data_ref: Option<String>

Runtime data-field reference for the span’s TEXT CONTENT. When Some(path), the scene compiler’s data pre-pass looks path up in the active DataContext and REPLACES TextSpan::text with the resolved value (styled by TextSpan::data_format when set). A missing field emits data.missing_field and leaves the authored text (the fallback). None keeps the literal text unchanged (byte-identical to a span without the attribute). KDL: data-ref="revenue.total".

§data_format: Option<DataFormat>

Optional display format applied to the resolved TextSpan::data_ref value (currency / percent / number, with optional precision + locale). Only meaningful when data_ref is Some. None substitutes the raw field value verbatim. KDL: format="currency" precision=2.

§highlight: Option<PropertyValue>

Per-span highlight (text background) color; usually a token ref. None = no highlight (byte-identical to a span without it). When Some, the renderer emits a filled rect behind the span’s glyphs covering the full ascent-to-descent band so the text reads like a marker-pen highlight. KDL: span highlight=(token)"color.mark" "text".

§code: Option<bool>

Inline code mark: when Some(true), the span is rendered in the bundled monospace family (“Noto Sans Mono”) with a subtle background rect behind it (the internal CODE_BG default color). None or Some(false) keeps the node’s own font family (byte-identical to a span without it). KDL: span "text" code=#true.

§link: Option<String>

Hyperlink URL carried on the span. None = no link (byte-identical to a span without it). When Some(url), the span is rendered with an underline and the internal LINK_COLOR default color when the span has no explicit fill; a span that already has a fill keeps its author color. In PDF output the URL becomes a clickable /Link annotation over the span (when the text is selectable). KDL: span "text" link="https://example.com".

Trait Implementations§

Source§

impl Clone for TextSpan

Source§

fn clone(&self) -> TextSpan

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextSpan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TextSpan

Source§

fn eq(&self, other: &TextSpan) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TextSpan

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.