pub struct ShapingParams {
pub size: f32,
pub direction: Direction,
pub language: Option<String>,
pub script: Option<String>,
pub features: Vec<(String, u32)>,
pub variations: Vec<(String, f32)>,
pub letter_spacing: f32,
}Fields§
§size: f32§direction: Direction§language: Option<String>§script: Option<String>§features: Vec<(String, u32)>§variations: Vec<(String, f32)>§letter_spacing: f32Implementations§
Source§impl ShapingParams
impl ShapingParams
Sourcepub fn validate(&self) -> Result<(), ShapingError>
pub fn validate(&self) -> Result<(), ShapingError>
Validate shaping parameters against security limits
Returns an error if:
- Font size is not finite (
NaN,+/-inf) - Font size exceeds
MAX_FONT_SIZE(currently 100,000 pixels) - Font size is negative or zero
§Example
use typf_core::ShapingParams;
let params = ShapingParams { size: 48.0, ..Default::default() };
params.validate().expect("valid params");
let bad_params = ShapingParams { size: 200_000.0, ..Default::default() };
assert!(bad_params.validate().is_err());Trait Implementations§
Source§impl Clone for ShapingParams
impl Clone for ShapingParams
Source§fn clone(&self) -> ShapingParams
fn clone(&self) -> ShapingParams
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 ShapingParams
impl Debug for ShapingParams
Auto Trait Implementations§
impl Freeze for ShapingParams
impl RefUnwindSafe for ShapingParams
impl Send for ShapingParams
impl Sync for ShapingParams
impl Unpin for ShapingParams
impl UnsafeUnpin for ShapingParams
impl UnwindSafe for ShapingParams
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