pub struct Text {
pub content: String,
pub position: Point,
pub max_width: f32,
pub color: Color,
pub size: Pixels,
pub line_height: LineHeight,
pub font: Font,
pub align_x: Alignment,
pub align_y: Vertical,
pub shaping: Shaping,
}geometry only.Expand description
A bunch of text that can be drawn to a canvas
Fields§
§content: StringThe contents of the text
position: PointThe position of the text relative to the alignment properties.
By default, this position will be relative to the top-left corner coordinate meaning that if the horizontal and vertical alignments are unchanged, this property will tell where the top-left corner of the text should be placed.
By changing the horizontal_alignment and vertical_alignment properties, you are are able to change what part of text is placed at this positions.
For example, when the horizontal_alignment and vertical_alignment are set to Center, the center of the text will be placed at the given position NOT the top-left coordinate.
max_width: f32The maximum horizontal space available for this Text.
Text will break into new lines when the width is reached.
color: ColorThe color of the text
size: PixelsThe size of the text
line_height: LineHeightThe line height of the text.
font: FontThe font of the text
align_x: AlignmentThe horizontal alignment of the text
align_y: VerticalThe vertical alignment of the text
shaping: ShapingThe shaping strategy of the text.