#[non_exhaustive]pub struct PositionOptions {
pub frame: PositionFrame,
pub bold_from_weight: bool,
pub bold_weight_threshold: u16,
}Expand description
Options of the positioned-text and region APIs, taken by their
_with_options variants (extract_text_with_positions_mem_with_options,
extract_text_with_positions_and_rotations_mem_with_options,
extract_text_in_regions_mem_with_options,
extract_tables_in_regions_mem_with_options).
The default is what the plain and _in_frame variants do.
use pdf_inspector::{PositionFrame, PositionOptions};
let options = PositionOptions::new()
.frame(PositionFrame::Display)
.bold_from_weight(true)
.bold_weight_threshold(700);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.frame: PositionFrameCoordinate frame items are reported in and region rects are read
in; PositionFrame::Sheet by default.
bold_from_weight: boolRead bold from the font’s weight class as well. When set,
TextItem::is_bold is also true for items whose
TextItem::font_weight is bold_weight_threshold (600, SemiBold,
by default) or more, TextItem::bold_source says so, and adjacent
runs are merged by that verdict: a run the weight makes bold stays
apart from its plain neighbours, so a heavier run inside a lighter
paragraph keeps its own item, while runs whose weights differ but
agree on bold — both below the threshold, or both at or above it —
merge as usual. Off by default: is_bold and item merging are then
exactly what they were before the option existed, and font_weight
is reported either way.
bold_weight_threshold: u16The weight class from which bold_from_weight reads bold, on the
100..=900 scale: 600 by default, so SemiBold and heavier faces are
bold. It matters only when bold_from_weight is set; a value outside
the scale is clamped into it either way.
Implementations§
Source§impl PositionOptions
impl PositionOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
The defaults: sheet frame, bold not read from the weight class, a threshold of 600 for when it is.
Sourcepub fn frame(self, frame: PositionFrame) -> Self
pub fn frame(self, frame: PositionFrame) -> Self
Set the coordinate frame.
Sourcepub fn bold_from_weight(self, bold_from_weight: bool) -> Self
pub fn bold_from_weight(self, bold_from_weight: bool) -> Self
Set whether bold is also read from the weight class.
Sourcepub fn bold_weight_threshold(self, threshold: u16) -> Self
pub fn bold_weight_threshold(self, threshold: u16) -> Self
Set the weight class from which bold is read when bold_from_weight
is on: 600 by default, valid values 100..=900.
Trait Implementations§
Source§impl Clone for PositionOptions
impl Clone for PositionOptions
impl Copy for PositionOptions
Source§impl Debug for PositionOptions
impl Debug for PositionOptions
Source§impl Default for PositionOptions
impl Default for PositionOptions
impl Eq for PositionOptions
Source§impl PartialEq for PositionOptions
impl PartialEq for PositionOptions
impl StructuralPartialEq for PositionOptions
Auto Trait Implementations§
impl Freeze for PositionOptions
impl RefUnwindSafe for PositionOptions
impl Send for PositionOptions
impl Sync for PositionOptions
impl Unpin for PositionOptions
impl UnsafeUnpin for PositionOptions
impl UnwindSafe for PositionOptions
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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