Skip to main content

DrawGlyphs

Struct DrawGlyphs 

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

Builder for encoding a glyph run.

Created using Scene::draw_glyphs.

Implementations§

Source§

impl<'a> DrawGlyphs<'a>

Source

pub fn new(scene: &'a mut Scene, font: &FontData) -> 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 brush_transform(self, transform: Option<Affine>) -> Self

Sets the transform applied to the brush contents.

This is applied after the global run transform and is encoded as the glyph run’s paint transform. It affects transformed brushes such as gradients and images; solid colors ignore it.

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 font_embolden(self, embolden: FontEmbolden) -> Self

Sets synthetic embolden settings.

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.

This supports emoji fonts in COLR and bitmap formats. style is ignored for these fonts.

For these glyphs, the given brush is used as the “foreground color”, and should be Solid for maximum compatibility.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'a> UnsafeUnpin 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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