Struct vello::DrawGlyphs

source ·
pub struct DrawGlyphs<'a> { /* private fields */ }
Expand description

Builder for encoding a glyph run.

Implementations§

source§

impl<'a> DrawGlyphs<'a>

source

pub fn new(encoding: &'a mut Encoding, font: &Font) -> Self

Creates a new builder for encoding a glyph run for the specified encoding with the given font.

source

pub fn transform(self, transform: Affine) -> Self

Sets the global transform. This is applied to all glyphs after the offset translation.

The default value is the identity matrix.

source

pub fn glyph_transform(self, transform: Option<Affine>) -> Self

Sets the per-glyph transform. This is applied to all glyphs prior to offset translation. This is common used for applying a shear to simulate an oblique font.

The default value is None.

source

pub fn font_size(self, size: f32) -> Self

Sets the font size in pixels per em units.

The default value is 16.0.

source

pub fn hint(self, hint: bool) -> Self

Sets whether to enable hinting.

The default value is false.

source

pub fn normalized_coords(self, coords: &[NormalizedCoord]) -> Self

Sets the normalized design space coordinates for a variable font instance.

source

pub fn brush(self, brush: impl Into<BrushRef<'a>>) -> Self

Sets the brush.

The default value is solid black.

source

pub fn brush_alpha(self, alpha: f32) -> Self

Sets an additional alpha multiplier for the brush.

The default value is 1.0.

source

pub fn draw( self, style: impl Into<StyleRef<'a>>, glyphs: impl Iterator<Item = Glyph>, )

Encodes a fill or stroke for the given sequence of glyphs and consumes the builder.

The style parameter accepts either Fill or &Stroke types.

Auto Trait Implementations§

§

impl<'a> Freeze for DrawGlyphs<'a>

§

impl<'a> !RefUnwindSafe for DrawGlyphs<'a>

§

impl<'a> Send for DrawGlyphs<'a>

§

impl<'a> Sync for DrawGlyphs<'a>

§

impl<'a> Unpin for DrawGlyphs<'a>

§

impl<'a> !UnwindSafe for DrawGlyphs<'a>

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<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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,