pub struct TextSpan {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<[u8; 4]>,
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>,
/* private fields */
}Expand description
A single text span at a specific position.
Fields§
§text: StringThe extracted text.
x: f64X position in user space.
y: f64Y position in user space.
width: f64Approximate bounding-box width in user space.
height: f64Approximate bounding-box height in user space.
font_size: f64Font size (approximate, from transform).
font_name: Option<String>PostScript name of the font, with any 6-character subset prefix stripped
(e.g. Helvetica-Bold, TimesNewRomanPS-BoldMT). None for Type1
standard-14 fonts and Type3 fonts where no embedded font data is
available through the public pdf-interpret API.
is_bold: boolInferred bold style: weight >= 700 or PostScript name suggests bold
(“bold”, “demi”, “semibold”, “heavy”, “black”). Defaults false when
no descriptor data is reachable.
is_italic: boolInferred italic style: FontDescriptor /Italic flag set or PostScript
name suggests italic/oblique/slant. Defaults false when no descriptor
data is reachable.
color: Option<[u8; 4]>Fill color as sRGB RGBA, derived from Paint::Color(c).to_rgba().to_rgba8()
at the moment of glyph paint. None for Paint::Pattern (tiling /
shading) — the editor falls back to “auto” in that case.
width_source: WidthSourceWhether glyph widths were measured from real font advance data or estimated.
char_bounds: Vec<[f64; 4]>Per-glyph bounding boxes in user-space, one entry per source glyph.
[x0, y0, x1, y1] with y0 < y1 (PDF coordinate frame).
transform: Option<[f64; 6]>Full affine transform of the span’s first glyph in user space,
[a, b, c, d, e, f] (kurbo coeffs of CTM × text-matrix). Captures
rotation and shear that (x, y, font_size) discards. None for spans
not built from a glyph (e.g. synthetic markers).
font_weight: Option<u16>Numeric font weight (~100–900) from the embedded font’s OS/2 table when
available. None for non-embedded / standard-14 fonts.
is_serif: Option<bool>Whether the font is serif, when determinable from embedded font data.
None when no embedded descriptor is reachable.
is_monospace: Option<bool>Whether the font is monospace, when determinable from embedded font data.
None when no embedded descriptor is reachable.
render_mode: Option<u8>Coarse PDF text render mode: 0 fill, 1 stroke, 3 invisible — the
only three values the renderer’s GlyphDrawMode expresses (the
fill+stroke / clip modes 2 and 4–7 are not distinguished). Reflects the
span’s first glyph. None for spans not built from a glyph.
font_metrics: Option<FontMetrics>Vertical font metrics (ascent/descent, optional cap/x-height) in /1000
em from the embedded font binary. None for non-embedded fonts.
Trait Implementations§
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 TextSpan
impl RefUnwindSafe for TextSpan
impl Send for TextSpan
impl Sync for TextSpan
impl Unpin for TextSpan
impl UnsafeUnpin for TextSpan
impl UnwindSafe for TextSpan
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 moreimpl<T> ParallelSend for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().