#[non_exhaustive]pub struct TextDraw {
pub font: Handle<Font>,
pub position: Vec2,
pub pivot: Vec2,
pub layout: TextLayout,
pub color: Color,
pub glyphs: GlyphMode,
pub layer: u8,
pub sort: SortMode,
}Expand description
A text to draw in the world, in a Font: what TextList::push
takes with the text itself.
Its glyphs are drawn as sprites of its layer at its depth, unrotated, each glyph’s corner on a whole virtual pixel: grouped by page, and in the order its characters are laid out on each, so that the glyphs of a font of two pages that overlap may draw out of their order.
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.font: Handle<Font>The font.
position: Vec2Where the pivot is in the world.
pivot: Vec2The point of the text’s block at position, normalized over the
block Font::measure gives: (0, 0) is its top-left corner, and
(0.5, 1) the middle of its bottom edge. The block’s corner is then
moved by whole pixels, so that its glyphs stay on whole pixels.
layout: TextLayoutHow it is laid out: wrapping, alignment and markup.
color: ColorIts color, sRGB, which tints the glyphs; a markup run’s color takes its place, with its alpha times this one’s.
glyphs: GlyphModeWhether the glyphs are a mask in the color, or keep their own.
layer: u8Higher layers are drawn in front of lower ones.
sort: SortModeHow it is ordered within its layer: SortMode::YSort by
position.y, as a sprite by its pivot. At one depth, the sprites go
first, then the texts in the order they were pushed. A shadow drawn
under its text needs the same depth, pushed first: one pixel lower,
a y-sorted shadow would be in front.