pub struct Text { /* private fields */ }
Expand description
Properties related to drawing the Text primitive.
Implementations§
source§impl Text
impl Text
sourcepub fn new(ctxt: DrawingContext<'_>, text: &str) -> Self
pub fn new(ctxt: DrawingContext<'_>, text: &str) -> Self
Begin drawing some text.
sourcepub fn line_wrap(self, line_wrap: Option<Wrap>) -> Self
pub fn line_wrap(self, line_wrap: Option<Wrap>) -> Self
Specify whether or not text should be wrapped around some width and how to do so.
The default value is DEFAULT_LINE_WRAP
.
sourcepub fn no_line_wrap(self) -> Self
pub fn no_line_wrap(self) -> Self
Specify that the Text should not wrap lines around the width.
Shorthand for builder.line_wrap(None)
.
sourcepub fn wrap_by_word(self) -> Self
pub fn wrap_by_word(self) -> Self
Line wrap the Text at the beginning of the first word that exceeds the width.
Shorthand for builder.line_wrap(Some(Wrap::Whitespace))
.
sourcepub fn wrap_by_character(self) -> Self
pub fn wrap_by_character(self) -> Self
Line wrap the Text at the beginning of the first character that exceeds the width.
Shorthand for builder.line_wrap(Some(Wrap::Character))
.
sourcepub fn font(self, font: Font) -> Self
pub fn font(self, font: Font) -> Self
A method for specifying the Font
used for displaying the Text
.
sourcepub fn justify(self, justify: Justify) -> Self
pub fn justify(self, justify: Justify) -> Self
Describe the end along the x axis to which the text should be aligned.
sourcepub fn left_justify(self) -> Self
pub fn left_justify(self) -> Self
Align the text to the left of its bounding Rect’s x axis range.
sourcepub fn center_justify(self) -> Self
pub fn center_justify(self) -> Self
Align the text to the middle of its bounding Rect’s x axis range.
sourcepub fn right_justify(self) -> Self
pub fn right_justify(self) -> Self
Align the text to the right of its bounding Rect’s x axis range.
sourcepub fn line_spacing(self, spacing: Scalar) -> Self
pub fn line_spacing(self, spacing: Scalar) -> Self
Specify how much vertical space should separate each line of text.
sourcepub fn y_align(self, align: Align) -> Self
pub fn y_align(self, align: Align) -> Self
Specify how the whole text should be aligned along the y axis of its bounding rectangle
sourcepub fn align_top(self) -> Self
pub fn align_top(self) -> Self
Align the top edge of the text with the top edge of its bounding rectangle.
sourcepub fn align_middle_y(self) -> Self
pub fn align_middle_y(self) -> Self
Align the middle of the text with the middle of the bounding rect along the y axis.
This is the default behaviour.
sourcepub fn align_bottom(self) -> Self
pub fn align_bottom(self) -> Self
Align the bottom edge of the text with the bottom edge of its bounding rectangle.
sourcepub fn with_style(self, style: Style) -> Self
pub fn with_style(self, style: Style) -> Self
Specify the entire styling for the Text.
sourcepub fn glyph_colors(self, colors: Vec<LinSrgba>) -> Self
pub fn glyph_colors(self, colors: Vec<LinSrgba>) -> Self
Set a color for each glyph. Colors unspecified glyphs using the drawing color.
Trait Implementations§
source§impl RenderPrimitive for Text
impl RenderPrimitive for Text
source§fn render_primitive(
self,
ctxt: RenderContext<'_>,
mesh: &mut Mesh
) -> PrimitiveRender
fn render_primitive( self, ctxt: RenderContext<'_>, mesh: &mut Mesh ) -> PrimitiveRender
source§impl SetColor<f32> for Text
impl SetColor<f32> for Text
source§fn rgba_mut(&mut self) -> &mut Option<LinSrgba>
fn rgba_mut(&mut self) -> &mut Option<LinSrgba>
source§fn color<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<S>,
fn color<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<S>,
source§fn rgb8(self, r: u8, g: u8, b: u8) -> Selfwhere
S: Float,
fn rgb8(self, r: u8, g: u8, b: u8) -> Selfwhere
S: Float,
source§fn rgba<T>(self, r: T, g: T, b: T, a: T) -> Self
fn rgba<T>(self, r: T, g: T, b: T, a: T) -> Self
source§fn rgba8(self, r: u8, g: u8, b: u8, a: u8) -> Selfwhere
S: Float,
fn rgba8(self, r: u8, g: u8, b: u8, a: u8) -> Selfwhere
S: Float,
source§fn hsl(self, h: S, s: S, l: S) -> Self
fn hsl(self, h: S, s: S, l: S) -> Self
source§fn hsla(self, h: S, s: S, l: S, a: S) -> Self
fn hsla(self, h: S, s: S, l: S, a: S) -> Self
source§fn hsv(self, h: S, s: S, v: S) -> Selfwhere
S: Float,
fn hsv(self, h: S, s: S, v: S) -> Selfwhere
S: Float,
source§impl SetDimensions for Text
impl SetDimensions for Text
source§fn properties(&mut self) -> &mut Properties
fn properties(&mut self) -> &mut Properties
source§impl SetOrientation for Text
impl SetOrientation for Text
source§fn properties(&mut self) -> &mut Properties
fn properties(&mut self) -> &mut Properties
source§fn look_at(self, target: Point3) -> Self
fn look_at(self, target: Point3) -> Self
source§fn x_radians(self, x: f32) -> Self
fn x_radians(self, x: f32) -> Self
source§fn y_radians(self, y: f32) -> Self
fn y_radians(self, y: f32) -> Self
source§fn z_radians(self, z: f32) -> Self
fn z_radians(self, z: f32) -> Self
source§fn x_degrees(self, x: f32) -> Self
fn x_degrees(self, x: f32) -> Self
source§fn y_degrees(self, y: f32) -> Self
fn y_degrees(self, y: f32) -> Self
source§fn z_degrees(self, z: f32) -> Self
fn z_degrees(self, z: f32) -> Self
source§fn x_turns(self, x: f32) -> Self
fn x_turns(self, x: f32) -> Self
source§fn y_turns(self, y: f32) -> Self
fn y_turns(self, y: f32) -> Self
source§fn z_turns(self, z: f32) -> Self
fn z_turns(self, z: f32) -> Self
source§fn radians(self, v: Vec3) -> Self
fn radians(self, v: Vec3) -> Self
source§fn degrees(self, v: Vec3) -> Self
fn degrees(self, v: Vec3) -> Self
source§fn turns(self, v: Vec3) -> Self
fn turns(self, v: Vec3) -> Self
source§fn euler(self, e: Vec3) -> Self
fn euler(self, e: Vec3) -> Self
source§fn quaternion(self, q: Quat) -> Self
fn quaternion(self, q: Quat) -> Self
source§impl SetPosition for Text
impl SetPosition for Text
source§fn properties(&mut self) -> &mut Properties
fn properties(&mut self) -> &mut Properties
Auto Trait Implementations§
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more