pub struct TextLayout {
pub font_size: f32,
pub line_height: f32,
pub color: Color,
pub area: MathRect,
pub horizontal_alignment: TextAlignment,
pub vertical_alignment: TextAlignment,
}Expand description
Defines the layout parameters for rendering text.
§Fields
font_size: The size of the font in pixels.line_height: The height of each line of text.color: The color of the text.area: The rectangular area within which the text is rendered.horizontal_alignment: The horizontal alignment of the text.vertical_alignment: The vertical alignment of the text.
§Examples
use grafo::{TextAlignment, TextLayout};
use grafo::Color;
use grafo::MathRect;
let layout = TextLayout {
font_size: 16.0,
line_height: 20.0,
color: Color::rgb(255, 255, 255), // White text
area: MathRect {
min: (0.0, 0.0).into(),
max: (200.0, 50.0).into(),
},
horizontal_alignment: TextAlignment::Center,
vertical_alignment: TextAlignment::Center,
};Fields§
§font_size: f32The size of the font in pixels.
line_height: f32The height of each line of text.
color: ColorThe color of the text.
area: MathRectThe rectangular area within which the text is rendered.
horizontal_alignment: TextAlignmentThe horizontal alignment of the text.
vertical_alignment: TextAlignmentThe vertical alignment of the text.
Trait Implementations§
Source§impl Clone for TextLayout
impl Clone for TextLayout
Source§fn clone(&self) -> TextLayout
fn clone(&self) -> TextLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextLayout
impl Debug for TextLayout
Source§impl PartialEq for TextLayout
impl PartialEq for TextLayout
impl Copy for TextLayout
impl StructuralPartialEq for TextLayout
Auto Trait Implementations§
impl Freeze for TextLayout
impl RefUnwindSafe for TextLayout
impl Send for TextLayout
impl Sync for TextLayout
impl Unpin for TextLayout
impl UnwindSafe for TextLayout
Blanket Implementations§
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
Mutably borrows from an owned value. Read more