pub struct BlockLayoutParams {Show 21 fields
pub block_id: usize,
pub position: usize,
pub text: String,
pub fragments: Vec<FragmentParams>,
pub alignment: Alignment,
pub top_margin: f32,
pub bottom_margin: f32,
pub left_margin: f32,
pub right_margin: f32,
pub text_indent: f32,
pub list_marker: String,
pub list_indent: f32,
pub tab_positions: Vec<f32>,
pub base_direction: TextDirection,
pub neutral_direction: TextDirection,
pub language: Option<String>,
pub line_height_multiplier: Option<f32>,
pub non_breakable_lines: bool,
pub hyphenation: Option<Hyphenation>,
pub checkbox: Option<bool>,
pub background_color: Option<[f32; 4]>,
}Expand description
Parameters extracted from text-document’s BlockFormat / TextFormat. This is a plain struct so block layout doesn’t depend on text-document types.
Fields§
§block_id: usize§position: usize§text: String§fragments: Vec<FragmentParams>§alignment: Alignment§top_margin: f32§bottom_margin: f32§left_margin: f32§right_margin: f32§text_indent: f32§list_marker: StringList marker text (e.g., “1.”, “•”, “a)”). Empty if not a list item.
list_indent: f32Additional left indent for list items (in pixels).
tab_positions: Vec<f32>Tab stop positions in pixels from the left margin.
base_direction: TextDirectionThe paragraph’s base reading direction.
Auto applies UAX #9 rules P2/P3 (first strong character wins).
An explicit direction overrides that, which is what a stored
per-block direction is for: auto-detection reads an Arabic
paragraph opening with a Latin acronym as left-to-right.
Drives three things: which direction each bidi run shapes with,
the visual order of a line’s runs, and — when alignment is
Start/End — which edge the text sits against.
neutral_direction: TextDirectionThe direction an Auto paragraph takes when its text has no strongly
directional character: an empty paragraph, or one of digits, spaces
and punctuation. UAX #9 says left to right, which LeftToRight and
Auto both give; a host whose block is for a right-to-left language
(an empty field for Arabic) says RightToLeft. Ignored when
base_direction is explicit. See
resolve_paragraph_direction.
language: Option<String>The language the block’s text is written in, a BCP 47 tag (ja,
sr-Cyrl, zh-Hant). None when the host did not say.
The shaper is told it, so a font’s language-specific forms are used
(OpenType locl), and it decides how Han characters are drawn:
Japanese, Korean, Simplified or Traditional Chinese forms. Separate from
hyphenation, which may be off for a block whose
language is known.
line_height_multiplier: Option<f32>Line height multiplier. 1.0 = normal (from font metrics), 1.5 = 150%, 2.0 = double. None means use font metrics (ascent + descent + leading).
non_breakable_lines: boolIf true, prevent line wrapping. The entire block is one long line.
hyphenation: Option<Hyphenation>Hyphenation during line wrapping (None = off). See
crate::types::Hyphenation.
checkbox: Option<bool>Checkbox marker: None = no checkbox, Some(false) = unchecked, Some(true) = checked.
background_color: Option<[f32; 4]>Block background color (RGBA). None means transparent.