pub struct TextSpan {Show 18 fields
pub(crate) start: usize,
pub(crate) end: usize,
pub(crate) fill: Option<Fill>,
pub(crate) stroke: Option<Stroke>,
pub(crate) paint_order: PaintOrder,
pub(crate) font: Font,
pub(crate) font_size: NonZeroPositiveF32,
pub(crate) small_caps: bool,
pub(crate) apply_kerning: bool,
pub(crate) decoration: TextDecoration,
pub(crate) dominant_baseline: DominantBaseline,
pub(crate) alignment_baseline: AlignmentBaseline,
pub(crate) baseline_shift: Vec<BaselineShift>,
pub(crate) visible: bool,
pub(crate) letter_spacing: f32,
pub(crate) word_spacing: f32,
pub(crate) text_length: Option<f32>,
pub(crate) length_adjust: LengthAdjust,
}Expand description
A text style span.
Spans do not overlap inside a text chunk.
Fields§
§start: usize§end: usize§fill: Option<Fill>§stroke: Option<Stroke>§paint_order: PaintOrder§font: Font§font_size: NonZeroPositiveF32§small_caps: bool§apply_kerning: bool§decoration: TextDecoration§dominant_baseline: DominantBaseline§alignment_baseline: AlignmentBaseline§baseline_shift: Vec<BaselineShift>§visible: bool§letter_spacing: f32§word_spacing: f32§text_length: Option<f32>§length_adjust: LengthAdjustImplementations§
Source§impl TextSpan
impl TextSpan
Sourcepub fn start(&self) -> usize
pub fn start(&self) -> usize
A span start in bytes.
Offset is relative to the parent text chunk and not the parent text element.
Sourcepub fn end(&self) -> usize
pub fn end(&self) -> usize
A span end in bytes.
Offset is relative to the parent text chunk and not the parent text element.
Sourcepub fn paint_order(&self) -> PaintOrder
pub fn paint_order(&self) -> PaintOrder
A paint order style.
Sourcepub fn font_size(&self) -> NonZeroPositiveF32
pub fn font_size(&self) -> NonZeroPositiveF32
A font size.
Sourcepub fn small_caps(&self) -> bool
pub fn small_caps(&self) -> bool
Indicates that small caps should be used.
Set by font-variant="small-caps"
Sourcepub fn apply_kerning(&self) -> bool
pub fn apply_kerning(&self) -> bool
Indicates that a kerning should be applied.
Supports both kerning and font-kerning properties.
Sourcepub fn decoration(&self) -> &TextDecoration
pub fn decoration(&self) -> &TextDecoration
A span decorations.
Sourcepub fn dominant_baseline(&self) -> DominantBaseline
pub fn dominant_baseline(&self) -> DominantBaseline
A span dominant baseline.
Sourcepub fn alignment_baseline(&self) -> AlignmentBaseline
pub fn alignment_baseline(&self) -> AlignmentBaseline
A span alignment baseline.
Sourcepub fn baseline_shift(&self) -> &[BaselineShift]
pub fn baseline_shift(&self) -> &[BaselineShift]
A list of all baseline shift that should be applied to this span.
Ordered from text element down to the actual span element.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
A visibility property.
Sourcepub fn letter_spacing(&self) -> f32
pub fn letter_spacing(&self) -> f32
A letter spacing property.
Sourcepub fn word_spacing(&self) -> f32
pub fn word_spacing(&self) -> f32
A word spacing property.
Sourcepub fn text_length(&self) -> Option<f32>
pub fn text_length(&self) -> Option<f32>
A text length property.
Sourcepub fn length_adjust(&self) -> LengthAdjust
pub fn length_adjust(&self) -> LengthAdjust
A length adjust property.