Skip to main content

NopFilterSink

Struct NopFilterSink 

Source
pub struct NopFilterSink<'a, S> {
    is_open: bool,
    start: Option<(Fixed, Fixed)>,
    pending_element: Option<PendingElement>,
    inner: &'a mut S,
}
Expand description

Command sink adapter that suppresses degenerate move and line commands.

FreeType avoids emitting empty contours and zero length lines to prevent artifacts when stem darkening is enabled. We don’t support stem darkening because it’s not enabled by any of our clients but we remove the degenerate elements regardless to match the output.

See https://gitlab.freedesktop.org/freetype/freetype/-/blob/80a507a6b8e3d2906ad2c8ba69329bd2fb2a85ef/src/psaux/pshints.c#L1786

Fields§

§is_open: bool§start: Option<(Fixed, Fixed)>§pending_element: Option<PendingElement>§inner: &'a mut S

Implementations§

Source§

impl<'a, S> NopFilterSink<'a, S>
where S: CommandSink,

Source

pub fn new(inner: &'a mut S) -> Self

Creates a new sink that suppresses degenerate move and line commands before forwarding the result to the given inner sink.

Source

fn flush_pending(&mut self, for_close: bool)

Trait Implementations§

Source§

impl<S> CommandSink for NopFilterSink<'_, S>
where S: CommandSink,

Source§

fn hstem(&mut self, y: Fixed, dy: Fixed)

Horizontal stem hint at y with height dy.
Source§

fn vstem(&mut self, x: Fixed, dx: Fixed)

Vertical stem hint at x with width dx.
Source§

fn hint_mask(&mut self, mask: &[u8])

Bitmask defining the hints that should be made active for the commands that follow.
Source§

fn counter_mask(&mut self, mask: &[u8])

Bitmask defining the counter hints that should be made active for the commands that follow.
Source§

fn clear_hints(&mut self)

Clear accumulated stem hints and all data derived from them.
Source§

fn move_to(&mut self, x: Fixed, y: Fixed)

Source§

fn line_to(&mut self, x: Fixed, y: Fixed)

Source§

fn curve_to( &mut self, cx1: Fixed, cy1: Fixed, cx2: Fixed, cy2: Fixed, x: Fixed, y: Fixed, )

Source§

fn close(&mut self)

Source§

fn finish(&mut self)

Called when charstring evaluation is complete.

Auto Trait Implementations§

§

impl<'a, S> Freeze for NopFilterSink<'a, S>

§

impl<'a, S> RefUnwindSafe for NopFilterSink<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for NopFilterSink<'a, S>
where S: Send,

§

impl<'a, S> Sync for NopFilterSink<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for NopFilterSink<'a, S>

§

impl<'a, S> UnsafeUnpin for NopFilterSink<'a, S>

§

impl<'a, S> !UnwindSafe for NopFilterSink<'a, S>

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

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.