Skip to main content

GlyphRunRenderer

Struct GlyphRunRenderer 

Source
pub struct GlyphRunRenderer<'a, 'b, Glyphs: Iterator<Item = Glyph> + Clone> { /* private fields */ }
Expand description

Helper struct for rendering a prepared glyph run.

Implementations§

Source§

impl<'a, 'b, Glyphs: Iterator<Item = Glyph> + Clone> GlyphRunRenderer<'a, 'b, Glyphs>

Source

pub fn fill_glyphs(&mut self, renderer: &mut impl GlyphRenderer)

Fills the glyphs with the current configuration.

Source

pub fn stroke_glyphs(&mut self, renderer: &mut impl GlyphRenderer)

Strokes the glyphs with the current configuration.

Source

pub fn stroke_adjustment(&self) -> f64

Return the scaling factor that should be applied to the stroke width when stroking this glyph run.

Source

pub fn render_decoration( &mut self, x_range: RangeInclusive<f32>, baseline_y: f32, offset: f32, size: f32, buffer: f32, renderer: &mut impl DrawSink, )

Render a decoration (like an underline) that skips over glyph descenders.

This implements text-decoration-skip-ink-like behavior, where the decoration line is interrupted where it would overlap with glyph outlines.

The x_range specifies the horizontal position of the decoration, and the offset and size specify its vertical position and height (relative to the baseline). The buffer specifies how much horizontal space to leave around each descender.

Trait Implementations§

Source§

impl<'a, 'b, Glyphs: Debug + Iterator<Item = Glyph> + Clone> Debug for GlyphRunRenderer<'a, 'b, Glyphs>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'b, Glyphs> Freeze for GlyphRunRenderer<'a, 'b, Glyphs>
where Glyphs: Freeze,

§

impl<'a, 'b, Glyphs> !RefUnwindSafe for GlyphRunRenderer<'a, 'b, Glyphs>

§

impl<'a, 'b, Glyphs> Send for GlyphRunRenderer<'a, 'b, Glyphs>
where Glyphs: Send,

§

impl<'a, 'b, Glyphs> Sync for GlyphRunRenderer<'a, 'b, Glyphs>
where Glyphs: Sync,

§

impl<'a, 'b, Glyphs> Unpin for GlyphRunRenderer<'a, 'b, Glyphs>
where Glyphs: Unpin,

§

impl<'a, 'b, Glyphs> UnsafeUnpin for GlyphRunRenderer<'a, 'b, Glyphs>
where Glyphs: UnsafeUnpin,

§

impl<'a, 'b, Glyphs> !UnwindSafe for GlyphRunRenderer<'a, 'b, Glyphs>

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