pub struct ReverseContourPen<'a, T: Pen> { /* private fields */ }
Expand description

Buffers commands until a close is seen, then plays in reverse on inner pen.

Reverses the winding direction of the contour. Keeps the first point unchanged. In FontTools terms we implement only reversedContour(…, outputImpliedClosingLine=True) as this appears to be necessary to ensure retention of interpolation.

https://github.com/fonttools/fonttools/blob/78e10d8b42095b709cd4125e592d914d3ed1558e/Lib/fontTools/pens/reverseContourPen.py#L8

Implementations§

source§

impl<'a, T: Pen> ReverseContourPen<'a, T>

source

pub fn new(inner_pen: &'a mut T) -> ReverseContourPen<'_, T>

source

pub fn flush(&mut self) -> Result<(), ContourReversalError>

Flush buffer into inner, reversing the winding order.

If start == end, as is typically in a [move, …, close] structure, start point is unchanged.

Requires an explicit call to afford the client the opportunity to receive errors.

Trait Implementations§

source§

impl<'a, T: Pen> Pen for ReverseContourPen<'a, T>

source§

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

Emit a command to begin a new subpath at (x, y).
source§

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

Emit a line segment from the current point to (x, y).
source§

fn quad_to(&mut self, cx0: f32, cy0: f32, x: f32, y: f32)

Emit a quadratic bezier segment from the current point with a control point at (cx0, cy0) and ending at (x, y).
source§

fn curve_to(&mut self, cx0: f32, cy0: f32, cx1: f32, cy1: f32, x: f32, y: f32)

Emit a cubic bezier segment from the current point with control points at (cx0, cy0) and (cx1, cy1) and ending at (x, y).
source§

fn close(&mut self)

Emit a command to close the current subpath.

Auto Trait Implementations§

§

impl<'a, T> RefUnwindSafe for ReverseContourPen<'a, T>where T: RefUnwindSafe,

§

impl<'a, T> Send for ReverseContourPen<'a, T>where T: Send,

§

impl<'a, T> Sync for ReverseContourPen<'a, T>where T: Sync,

§

impl<'a, T> Unpin for ReverseContourPen<'a, T>

§

impl<'a, T> !UnwindSafe for ReverseContourPen<'a, T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<U, T> ToOwnedObj<U> for Twhere U: FromObjRef<T>,

source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
source§

impl<U, T> ToOwnedTable<U> for Twhere U: FromTableRef<T>,

source§

fn to_owned_table(&self) -> U

source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.