pub struct TextDocument {
pub text: String,
pub font: String,
pub size: f32,
pub justify: u8,
pub tracking: f32,
pub line_height: f32,
pub baseline_shift: f32,
pub fill_color: Vec<f32>,
pub stroke_color: Vec<f32>,
pub stroke_width: f32,
pub position: Option<[f32; 2]>,
pub box_size: Option<[f32; 2]>,
}Expand description
Resolved text styling and layout data.
Fields§
§text: StringText content.
font: StringFont name.
size: f32Font size.
justify: u8Justification mode.
tracking: f32Tracking adjustment.
line_height: f32Line height.
baseline_shift: f32Baseline shift.
fill_color: Vec<f32>Fill color as normalized RGB or RGBA components.
stroke_color: Vec<f32>Stroke color as normalized RGB or RGBA components.
stroke_width: f32Stroke width.
position: Option<[f32; 2]>Text box position.
box_size: Option<[f32; 2]>Text box size.
Implementations§
Source§impl TextDocument
impl TextDocument
Sourcepub fn fill_color_rgba(&self) -> Option<[u8; 4]>
pub fn fill_color_rgba(&self) -> Option<[u8; 4]>
Converts the fill color into RGBA8 if enough components are present.
Sourcepub fn stroke_color_rgba(&self) -> Option<[u8; 4]>
pub fn stroke_color_rgba(&self) -> Option<[u8; 4]>
Converts the stroke color into RGBA8 if enough components are present.
Sourcepub fn effective_line_height(&self) -> f32
pub fn effective_line_height(&self) -> f32
Returns the effective line height, falling back to a size-based default.
Trait Implementations§
Source§impl Clone for TextDocument
impl Clone for TextDocument
Source§fn clone(&self) -> TextDocument
fn clone(&self) -> TextDocument
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 TextDocument
impl Debug for TextDocument
Source§impl Default for TextDocument
impl Default for TextDocument
Source§fn default() -> TextDocument
fn default() -> TextDocument
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TextDocument
impl<'de> Deserialize<'de> for TextDocument
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TextDocument
impl RefUnwindSafe for TextDocument
impl Send for TextDocument
impl Sync for TextDocument
impl Unpin for TextDocument
impl UnsafeUnpin for TextDocument
impl UnwindSafe for TextDocument
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