Skip to main content

Segment

Struct Segment 

Source
pub struct Segment {
Show 15 fields pub(crate) flags: TopoFlags, pub(crate) dir: Direction, pub(crate) pos: i16, pub(crate) delta: i16, pub(crate) min_coord: i16, pub(crate) max_coord: i16, pub(crate) height: i16, pub(crate) score: i32, pub(crate) len: i32, pub(crate) link_ix: Option<u16>, pub(crate) serif_ix: Option<u16>, pub(crate) first_ix: u16, pub(crate) last_ix: u16, pub(crate) edge_ix: Option<u16>, pub(crate) edge_next_ix: Option<u16>,
}
Expand description

Sequence of points with a single dominant direction.

Fields§

§flags: TopoFlags

Flags describing the properties of the segment.

§dir: Direction

Dominant direction of the segment.

§pos: i16

Position of the segment.

§delta: i16

Deviation from segment position.

§min_coord: i16

Minimum coordinate of the segment.

§max_coord: i16

Maximum coordinate of the segment.

§height: i16

Hinted segment height.

§score: i32

Used during stem matching.

§len: i32

Used during stem matching.

§link_ix: Option<u16>

Index of best candidate for a stem link.

§serif_ix: Option<u16>

Index of best candidate for a serif link.

§first_ix: u16

Index of first point in the outline.

§last_ix: u16

Index of last point in the outline.

§edge_ix: Option<u16>

Index of edge that is associated with the segment.

§edge_next_ix: Option<u16>

Index of next segment in edge’s segment list.

Implementations§

Source§

impl Segment

Source

pub fn flags(&self) -> TopoFlags

Returns flags describing the properties of the segment.

Source

pub fn direction(&self) -> Direction

Returns the dominant direction of the segment.

Source

pub fn position(&self) -> i16

Returns the computed position of the segment.

Source

pub fn delta(&self) -> i16

Returns the deviation from the computed position.

Source

pub fn min_coord(&self) -> i16

Returns the minimum coordinate of the segment.

Source

pub fn max_coord(&self) -> i16

Returns the maximum coordinate of the segment.

Source

pub fn height(&self) -> i16

Returns the hinted height of the segment.

Source

pub fn score(&self) -> i32

Returns the computed score of the segment; used during stem matching.

Source

pub fn length(&self) -> i32

Returns the computed length of the segment; used during stem matching.

Returns the index of the best candidate for a stem link.

Source

pub fn serif_index(&self) -> Option<u16>

Returns the index of the best candidate for a serif link.

Source

pub fn point_indices(&self) -> (u16, u16)

Returns the indices of first and last points that define the segment.

Source

pub fn edge_index(&self) -> Option<u16>

Returns the index of edge that is associated with the segment.

Source

pub fn next_in_edge_index(&self) -> Option<u16>

Returns the index of next segment in the associated edge’s segment list.

Source§

impl Segment

Source

pub(crate) fn first(&self) -> usize

Source

pub(crate) fn first_point<'a>(&self, points: &'a [Point]) -> &'a Point

Source

pub(crate) fn last(&self) -> usize

Source

pub(crate) fn last_point<'a>(&self, points: &'a [Point]) -> &'a Point

Source

pub(crate) fn edge<'a>(&self, edges: &'a [Edge]) -> Option<&'a Edge>

Source

pub(crate) fn next_in_edge<'a>( &self, segments: &'a [Segment], ) -> Option<&'a Segment>

Returns the next segment in this segment’s parent edge.

Trait Implementations§

Source§

impl Clone for Segment

Source§

fn clone(&self) -> Segment

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Segment

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Segment

Source§

fn default() -> Segment

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Segment

Source§

fn eq(&self, other: &Segment) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Segment

Source§

impl Eq for Segment

Source§

impl StructuralPartialEq for Segment

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.