pub struct Word {
pub page: usize,
pub text: String,
pub bbox: [f64; 4],
pub block: usize,
pub line: usize,
pub word: usize,
pub dir: f64,
pub bold: bool,
pub italic: bool,
pub font_size: f64,
}Expand description
One word of a document’s text, with the box it was drawn in.
Built from the blocks PdfDocument::extract_blocks returns, so a word
carries where its block sits as well as where it sits itself. Words come
in reading order, block by block and line by line.
Fields§
§page: usize0-based page index the word was drawn on.
text: StringThe word, without surrounding whitespace.
bbox: [f64; 4]Bounding box in PDF user space, [x0, y0, x1, y1] with y up and
y0 < y1: the union of the word’s glyph boxes, in the frame block
boxes use.
block: usizePosition of the word’s block in the Vec extract_blocks returned
beside these words – the window’s numbering, not the document’s.
Block::index keeps the document’s own numbering when a window is
asked for; this is the index into the answer the caller is holding,
so blocks[word.block] is the block the word came from.
line: usize0-based line within the block, in the order the block’s lines read.
word: usize0-based word within the line, in the order the line reads.
dir: f64Baseline angle in degrees, counter-clockwise from +x; 0 upright.
A word joined across spans takes the angle of its longer piece, the left one on a tie – the same longest-piece rule as the style fields.
bold: boolWhether the word’s span is set bold.
italic: boolWhether the word’s span is set italic.
font_size: f64Font size of the word’s span, in points.
Trait Implementations§
impl StructuralPartialEq for Word
Auto Trait Implementations§
impl Freeze for Word
impl RefUnwindSafe for Word
impl Send for Word
impl Sync for Word
impl Unpin for Word
impl UnsafeUnpin for Word
impl UnwindSafe for Word
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
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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