pub struct TextRef<'a> {
pub text: &'a str,
pub size: f32,
pub raster_size: Option<f32>,
pub line_height: Option<f32>,
pub padding: Vec2,
pub color: Srgba,
pub shadow: Option<(Srgba, Vec2)>,
pub character_color: Option<&'a dyn Fn(usize, usize, char) -> Srgba>,
pub align: TextAlign,
pub position: TextPosition,
pub transform: Mat4,
pub character_transform: Option<&'a dyn Fn(usize, usize, char) -> (Mat4, Mat4)>,
}Expand description
Description of how a string slice should be rendered as a text mesh.
Fields§
§text: &'a strText to render
size: f32Font size used by the resulting mesh
raster_size: Option<f32>Font size used for glyph rasterization; when None, TextRef::size will be used
line_height: Option<f32>Line height scaling used by the resulting mesh
padding: Vec2Padding used by the resuling mesh
color: SrgbaFont color used by the resulting mesh
shadow: Option<(Srgba, Vec2)>Shadow color and offset user by the resulting mesh
character_color: Option<&'a dyn Fn(usize, usize, char) -> Srgba>Function to generate per-character colors
align: TextAlignAlignment used by the resulting mesh.
position: TextPositionPosition used by the resulting; see TextAlign for how this is computed
transform: Mat4Transform used by the resulting mesh
character_transform: Option<&'a dyn Fn(usize, usize, char) -> (Mat4, Mat4)>Function to generate per-character position and vertex transforms
Implementations§
Source§impl<'a> TextRef<'a>
impl<'a> TextRef<'a>
Sourcepub fn raster_size(self, raster_size: f32) -> Self
pub fn raster_size(self, raster_size: f32) -> Self
Specifies the font size used for glyph rasterization; when None, TextRef::size will be used.
Sourcepub fn line_height(self, line_height: f32) -> Self
pub fn line_height(self, line_height: f32) -> Self
Specifies the line height scaling used by the resulting mesh.
Sourcepub fn shadow(self, color: Srgba, offset: Vec2) -> Self
pub fn shadow(self, color: Srgba, offset: Vec2) -> Self
Specifies the shadow color and offset user by the resulting mesh.
Sourcepub fn character_color(
self,
color: &'a dyn Fn(usize, usize, char) -> Srgba,
) -> Self
pub fn character_color( self, color: &'a dyn Fn(usize, usize, char) -> Srgba, ) -> Self
Specifies the function to generate per-character colors.
These colors do overide the color set by TextRef::color.
Sourcepub fn align(self, align: TextAlign) -> Self
pub fn align(self, align: TextAlign) -> Self
Specifies the alignment used by the resulting mesh.
Sourcepub fn position(self, position: TextPosition) -> Self
pub fn position(self, position: TextPosition) -> Self
Specifies the position used by the resulting; see TextAlign for how this is computed.