[][src]Struct norad::glyph::builder::OutlineBuilder

pub struct OutlineBuilder { /* fields omitted */ }

An OutlineBuilder is a consuming builder for crate::glyph::Outline, not unlike a fontTools point pen.

Primarily to be used in conjunction with GlyphBuilder.

Implementations

impl OutlineBuilder[src]

pub fn new() -> Self[src]

pub fn begin_path(
    &mut self,
    identifier: Option<Identifier>
) -> Result<&mut Self, ErrorKind>
[src]

Start a new path to be added to the glyph with end_path().

Errors when:

  1. a path has been begun already but not ended yet.
  2. the identifier is not unique within the glyph.

pub fn add_point(
    &mut self,
    point: (f32, f32),
    segment_type: PointType,
    smooth: bool,
    name: Option<String>,
    identifier: Option<Identifier>
) -> Result<&mut Self, ErrorKind>
[src]

Add a point to the path begun by begin_path().

Errors when:

  1. begin_path() wasn't called first.
  2. the identifier is not unique within the outline.
  3. the point is an off-curve with the smooth attribute set.
  4. the point sequence is forbidden by the specification.

pub fn end_path(&mut self) -> Result<&mut Self, ErrorKind>[src]

Ends the path begun by begin_path() and adds the contour it to the glyph's outline.

Discards path in case of error.

Errors when:

  1. begin_path() wasn't called first.
  2. the point sequence is forbidden by the specification.

pub fn add_component(
    &mut self,
    base: GlyphName,
    transform: AffineTransform,
    identifier: Option<Identifier>
) -> Result<&mut Self, ErrorKind>
[src]

Add a component to the glyph.

Errors when the identifier is not unique within the glyph.

pub fn finish(self) -> Result<(Outline, HashSet<Identifier>), ErrorKind>[src]

Consume the builder and return the final Outline with the set of hashed indetifiers.

Errors when a path has been begun but not ended.

Trait Implementations

impl Debug for OutlineBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,