pub fn vertical_offset(
centred: bool,
config: &Config,
layout: &Layout,
) -> (f32, f32)Expand description
The offset a field’s text is drawn with.
Top alignment shifts nothing; centred alignment shifts by half the slack between the content and the plate. The same rule the appearance path uses, because the two must agree — a caret computed against a different offset from the one the glyphs were drawn with lands in the wrong place.
use pdfrum_doc::vt;
let layout = vt::layout("Hi", &config, &metrics);
// Top alignment shifts nothing at all.
assert_eq!(ops::vertical_offset(false, &config, &layout), (0.0, 0.0));
// Centred alignment never shifts horizontally.
let (x, _y) = ops::vertical_offset(true, &config, &layout);
assert_eq!(x, 0.0);