Skip to main content

paragraph

Function paragraph 

Source
pub fn paragraph(
    p: &mut dyn Painter,
    bounds: Rect,
    style: &TextStyle,
    color: Color,
    msg: &str,
    wrap: Wrap,
    max_lines: Option<usize>,
) -> TextDrawn
Expand description

Draws wrapped text: a block of lines, each aligned by style.justification within the rectangle, centered vertically when the block fits (top-aligned when it doesn’t). Lines that start below the rectangle are not drawn.

§Arguments

  • p - The painter, targeting the Widget.
  • bounds - The rectangle to draw within, in Widget coordinates.
  • style - The font and alignment.
  • color - The text color.
  • msg - The text; \n starts a new line.
  • wrap - How lines break (see wrap_text).
  • max_lines - The most lines; the last is cut with an ellipsis if the text needs more.

§Returns

The size of the block drawn (0 by 0 if nothing was drawn) and whether the text was cut to honor max_lines.