pub struct Section {
pub words: Vec<Word>,
pub lines: Vec<Line>,
pub rect: Rect,
}Expand description
One paragraph.
use pdfrum_doc::geom;
use pdfrum_doc::vt::{Config, Metrics, layout};
// Every character ten thousandths wide: the stub the layout assertions
// in this crate are written against.
let width = |_code: u32| 10;
let metrics = Metrics { width: &width, ascent: 1000, descent: -200 };
let config = Config {
plate: geom::rect(0.0, 0.0, 100.0, 40.0),
font_size: 10.0,
multi_line: true,
..Config::default()
};
let laid_out = layout("Hi", &config, &metrics);
// One paragraph, split on the line breaks the text carries.
let two = layout("a\nb", &config, &metrics);
assert_eq!(two.sections.len(), 2);Fields§
§words: Vec<Word>Its characters, in logical order.
lines: Vec<Line>Its lines, once broken.
rect: RectIts extent, y-down.
Trait Implementations§
impl StructuralPartialEq for Section
Auto Trait Implementations§
impl Freeze for Section
impl RefUnwindSafe for Section
impl Send for Section
impl Sync for Section
impl Unpin for Section
impl UnsafeUnpin for Section
impl UnwindSafe for Section
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
Mutably borrows from an owned value. Read more