pub struct TextShapingOptions {
pub font_size: Pt,
pub line_height: Option<Pt>,
pub letter_spacing: Option<f32>,
pub word_spacing: Option<f32>,
pub tab_width: Option<f32>,
pub max_width: Option<Pt>,
pub max_height: Option<Pt>,
pub align: TextAlign,
pub direction: TextDirection,
pub color: Color,
pub holes: Vec<TextHole>,
}Expand description
Options for text shaping and layout
Fields§
§font_size: PtFont size in points (1 pt = 1/72 inch)
line_height: Option<Pt>Line height in points (optional, defaults to font’s recommended line height)
letter_spacing: Option<f32>Letter spacing in points (0.0 = default spacing)
word_spacing: Option<f32>Word spacing in points (0.0 = default spacing)
tab_width: Option<f32>Width of tab character in points (default: 4 spaces)
max_width: Option<Pt>Maximum width of text block for line wrapping (None = no wrapping)
max_height: Option<Pt>Maximum height of text block (None = unlimited)
align: TextAlignHorizontal text alignment
direction: TextDirectionText direction (LTR or RTL)
color: ColorText color
holes: Vec<TextHole>Rectangular “holes” where text won’t flow
Implementations§
Source§impl TextShapingOptions
impl TextShapingOptions
Sourcepub fn new(font_size: Pt) -> Self
pub fn new(font_size: Pt) -> Self
Create new options with default values and the specified font size
Sourcepub fn with_max_width(self, max_width: Pt) -> Self
pub fn with_max_width(self, max_width: Pt) -> Self
Set the maximum width for line wrapping
Sourcepub fn with_max_height(self, max_height: Pt) -> Self
pub fn with_max_height(self, max_height: Pt) -> Self
Set the maximum height for text clipping
Sourcepub fn with_align(self, align: TextAlign) -> Self
pub fn with_align(self, align: TextAlign) -> Self
Set the text alignment
Sourcepub fn with_direction(self, direction: TextDirection) -> Self
pub fn with_direction(self, direction: TextDirection) -> Self
Set the text direction
Sourcepub fn with_color(self, color: Color) -> Self
pub fn with_color(self, color: Color) -> Self
Set the text color
Sourcepub fn with_line_height(self, line_height: Pt) -> Self
pub fn with_line_height(self, line_height: Pt) -> Self
Set the line height
Sourcepub fn with_letter_spacing(self, letter_spacing: f32) -> Self
pub fn with_letter_spacing(self, letter_spacing: f32) -> Self
Set the letter spacing
Trait Implementations§
Source§impl Clone for TextShapingOptions
impl Clone for TextShapingOptions
Source§fn clone(&self) -> TextShapingOptions
fn clone(&self) -> TextShapingOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextShapingOptions
impl Debug for TextShapingOptions
Auto Trait Implementations§
impl Freeze for TextShapingOptions
impl RefUnwindSafe for TextShapingOptions
impl Send for TextShapingOptions
impl Sync for TextShapingOptions
impl Unpin for TextShapingOptions
impl UnsafeUnpin for TextShapingOptions
impl UnwindSafe for TextShapingOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.