pub struct TextSpanInfo {Show 18 fields
pub text: String,
pub x: f64,
pub y: f64,
pub width: f64,
pub height: f64,
pub font_size: f64,
pub font_name: Option<String>,
pub is_bold: bool,
pub is_italic: bool,
pub color: Option<[f32; 3]>,
pub width_source: WidthSource,
pub char_bounds: Vec<[f64; 4]>,
pub transform: Option<[f64; 6]>,
pub font_weight: Option<u16>,
pub is_serif: Option<bool>,
pub is_monospace: Option<bool>,
pub render_mode: Option<u8>,
pub font_metrics: Option<FontMetrics>,
}Expand description
A positioned text span in PDF user space (origin bottom-left, y up).
JSON key renames mirror the established wire contract consumed by the editor; all optional metadata is omitted from JSON when absent, so existing clients are unaffected.
Fields§
§text: StringThe extracted text of the span.
x: f64X position in PDF user space.
y: f64Y position in PDF user space (baseline origin).
width: f64Span width in user space. Falls back to an estimate (½ em per character) when no measured width is available.
height: f64Span height in user space.
Mirrors the existing wire contract, which reports the font size (ascent extent) here. NOTE: this preserves prior behaviour exactly; richer ascent/descent metrics arrive in a later milestone.
font_size: f64Font size in points.
font_name: Option<String>PostScript font name with any 6-character subset prefix stripped. Omitted from JSON when unknown.
is_bold: boolInferred bold style.
is_italic: boolInferred italic style.
color: Option<[f32; 3]>Fill colour as sRGB [r, g, b] normalised to 0.0–1.0. Omitted from JSON
for pattern/shading paints.
width_source: WidthSourceWhether glyph widths came from real font metrics or an estimate.
Serialised as "Metric" / "Estimate".
char_bounds: Vec<[f64; 4]>Per-glyph bounding boxes [x0, y0, x1, y1] (y up). Omitted when empty.
transform: Option<[f64; 6]>Full affine transform [a, b, c, d, e, f] of the span’s first glyph.
Captures rotation/shear discarded by (x, y, fontSize).
font_weight: Option<u16>Numeric font weight (~100–900) from embedded font data, if available.
is_serif: Option<bool>Serif flag from embedded font data, if available.
is_monospace: Option<bool>Monospace flag from embedded font data, if available.
render_mode: Option<u8>Coarse PDF text render mode: 0 fill, 1 stroke, 3 invisible.
font_metrics: Option<FontMetrics>Vertical font metrics (/1000 em) from the embedded font, if available.
Trait Implementations§
Source§impl Clone for TextSpanInfo
impl Clone for TextSpanInfo
Source§fn clone(&self) -> TextSpanInfo
fn clone(&self) -> TextSpanInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextSpanInfo
impl Debug for TextSpanInfo
Source§impl From<&TextSpan> for TextSpanInfo
impl From<&TextSpan> for TextSpanInfo
Source§impl From<TextSpan> for TextSpanInfo
impl From<TextSpan> for TextSpanInfo
Auto Trait Implementations§
impl Freeze for TextSpanInfo
impl RefUnwindSafe for TextSpanInfo
impl Send for TextSpanInfo
impl Sync for TextSpanInfo
impl Unpin for TextSpanInfo
impl UnsafeUnpin for TextSpanInfo
impl UnwindSafe for TextSpanInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more