pub struct Config {
pub plate: Rect,
pub alignment: Alignment,
pub font_size: f32,
pub multi_line: bool,
pub auto_return: bool,
pub sub_word: Option<char>,
pub limit_char: usize,
pub char_array: usize,
pub direction: Direction,
}Expand description
How a piece of variable text is to be set.
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);
// A plain config struct with `Default` plus struct-update syntax.
assert_eq!(laid_out.sections.len(), 1);Fields§
§plate: RectThe box the text is set into.
alignment: AlignmentWhere lines sit horizontally.
font_size: f32The size, or zero to choose one automatically.
multi_line: boolWhether the text may occupy more than one line.
auto_return: boolWhether a line too long for the plate wraps.
sub_word: Option<char>The character every character is displayed as, for a password field. Widths use it too.
limit_char: usizeA cap on how many characters are set at all.
char_array: usizeA comb field’s cell count. Non-zero switches to comb layout.
direction: DirectionThe paragraph direction offered to the bidi resolver.
Trait Implementations§
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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