Struct three_d_text_builder::TextRef
source · 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 str
Text to render
size: f32
Font 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: Vec2
Padding used by the resuling mesh
color: Srgba
Font 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: TextAlign
Alignment used by the resulting mesh.
position: TextPosition
Position used by the resulting; see TextAlign
for how this is computed
transform: Mat4
Transform 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.