pub struct TextSpan {
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]>,
}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).
Trait Implementations§
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,
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 moreSource§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().