pub struct Word {
pub ch: u32,
pub x: f32,
pub y: f32,
pub tail: f32,
pub is_rtl: bool,
}Expand description
One character, placed.
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 entry per character, not per word.
let section = &laid_out.sections[0];
assert_eq!(section.words.len(), 2);
assert_eq!(section.words[0].ch, u32::from('H'));Fields§
§ch: u32The code point. A password field still records the real one; only its width and its output byte come from the substitute.
x: f32Position, y-down from the plate’s top-left.
y: f32Position, y-down from the plate’s top-left.
tail: f32Extra width added after this character, used by comb cells.
is_rtl: boolWhether the character sits in a right-to-left run.
Trait Implementations§
impl Copy for Word
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
Mutably borrows from an owned value. Read more