Skip to main content

FontTweak

Struct FontTweak 

Source
pub struct FontTweak {
    pub scale: f32,
    pub y_offset_factor: f32,
    pub y_offset: f32,
    pub hinting: Option<bool>,
    pub hinting_target: HintingTarget,
    pub subpixel_binning: Option<bool>,
    pub coords: VariationCoords,
    pub thin_space_width: f32,
    pub tab_size: f32,
}
Expand description

Extra scale and vertical tweak to apply to all text of a certain font.

Fields§

§scale: f32

Scale the font’s glyphs by this much. this is only a visual effect and does not affect the text layout.

Default: 1.0 (no scaling).

§y_offset_factor: f32

Shift font’s glyphs downwards by this fraction of the font size (in points). this is only a visual effect and does not affect the text layout.

Affects larger font sizes more.

A positive value shifts the text downwards. A negative value shifts it upwards.

Example value: -0.2.

§y_offset: f32

Shift font’s glyphs downwards by this amount of logical points. this is only a visual effect and does not affect the text layout.

Affects all font sizes equally.

Example value: 2.0.

§hinting: Option<bool>

Override the global font hinting setting for this specific font.

None means use the global setting in TextOptions::font_hinting.

§hinting_target: HintingTarget

How to grid-fit the glyph outlines when hinting is enabled.

Has no effect when hinting is disabled (see Self::hinting).

§subpixel_binning: Option<bool>

Override the global sub-pixel binning setting for this specific font.

None means use the global setting in TextOptions::subpixel_binning.

§coords: VariationCoords

Override the font’s default variation coordinates for its axes (“wght”, etc.).

§thin_space_width: f32

Width of a thin space (\u{2009}) and narrow no-break space (\u{202F}), as a fraction of the normal space width.

Thin space is often used as a thousands separator: 1 234 567.

Default: 0.5 (half a normal space).

§tab_size: f32

Width of a tab character (\t), measured in number of space widths.

Default: 4.0.

Trait Implementations§

Source§

impl Clone for FontTweak

Source§

fn clone(&self) -> FontTweak

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FontTweak

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FontTweak

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for FontTweak

Source§

fn eq(&self, other: &FontTweak) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FontTweak

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.