pub fn text(
p: &mut dyn Painter,
bounds: Rect,
style: &TextStyle,
color: Color,
msg: &str,
truncate: Truncate,
) -> TextDrawnExpand description
Draws a string of text within a rectangle.
The text is aligned horizontally according to style, wraps at the rectangle’s width, and is
centered vertically when it fits (top-aligned when it doesn’t). If it is wider than the
rectangle, truncate shortens it with an ellipsis (see fit_text). An empty string, or a
rectangle with no width, draws nothing.
§Arguments
p- The painter, targeting theWidget.bounds- The rectangle to draw within, inWidgetcoordinates.style- The font and alignment.color- The text color (overridesstyle.font_color, so aWidgetcan invert it).msg- The text to draw.truncate- How to shorten text that doesn’t fit.
§Returns
The size of the text drawn (0 by 0 if nothing was drawn) and whether it was shortened.