#[non_exhaustive]pub struct BlockVisualInfo {
pub block_id: usize,
pub x: f32,
pub content_x: f32,
pub marker_x: Option<f32>,
pub marker_width: f32,
pub y: f32,
pub height: f32,
}Expand description
Visual position and size of a laid-out block.
Returned by crate::DocumentFlow::block_visual_info and, with the
block’s lines, by crate::DocumentFlow::block_geometry.
Three x positions matter, and they are not the same:
x, the left edge of the column the block sits in;content_x, where the block’s text starts, after its left margin and any list or paragraph indent;marker_x, where its list or checkbox marker is drawn, in the indent area before the text.
Line rectangles returned by crate::DocumentFlow::block_geometry and
crate::DocumentFlow::block_line_geometry are relative to
content_x, not to x.
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.block_id: usizeBlock ID (matches BlockSnapshot::block_id).
x: f32X position of the left edge of the block’s column, relative to the
document start, in pixels. It does not include the block’s own left
margin or indent: a rectangle around the block’s text starts at
content_x, and one that also covers the marker
starts here.
Zero for a block in the document’s own column. A block inside a table cell or a frame has its own left origin: column 1 of a table does not start at the document’s left edge.
content_x: f32X position where the block’s text starts, relative to the document
start, in pixels: x plus the block’s left margin and its
list or paragraph indent. This is the origin of the x of every line
rectangle and segment the line geometry reports for the block, and the
origin the renderer paints glyphs from.
Equal to x for a block with no margin and no indent.
marker_x: Option<f32>X position of the block’s list or checkbox marker box, relative to the
document start, in pixels, or None when the block has no marker.
The marker is drawn in the indent area just before the text,
right-aligned with a small gap, and never left of the block’s left
margin. When the indent is narrower than the marker, the marker starts
at the left margin (x plus the margin) and its box overlaps the text.
In a right-to-left block it is currently still drawn at the left.
marker_width: f32Advance width of the marker, in pixels; 0.0 when the block has no
marker. The marker box is marker_x to marker_x + marker_width,
on the block’s first line.
y: f32Y position of the block’s top edge relative to the document start, in pixels.
height: f32Total height of the block including margins, in pixels.