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: TopoFlagsFlags describing the properties of the segment.
dir: DirectionDominant direction of the segment.
pos: i16Position of the segment.
delta: i16Deviation from segment position.
min_coord: i16Minimum coordinate of the segment.
max_coord: i16Maximum coordinate of the segment.
height: i16Hinted segment height.
score: i32Used during stem matching.
len: i32Used 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: u16Index of first point in the outline.
last_ix: u16Index 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
impl Segment
Sourcepub fn score(&self) -> i32
pub fn score(&self) -> i32
Returns the computed score of the segment; used during stem matching.
Sourcepub fn length(&self) -> i32
pub fn length(&self) -> i32
Returns the computed length of the segment; used during stem matching.
Sourcepub fn link_index(&self) -> Option<u16>
pub fn link_index(&self) -> Option<u16>
Returns the index of the best candidate for a stem link.
Sourcepub fn serif_index(&self) -> Option<u16>
pub fn serif_index(&self) -> Option<u16>
Returns the index of the best candidate for a serif link.
Sourcepub fn point_indices(&self) -> (u16, u16)
pub fn point_indices(&self) -> (u16, u16)
Returns the indices of first and last points that define the segment.
Sourcepub fn edge_index(&self) -> Option<u16>
pub fn edge_index(&self) -> Option<u16>
Returns the index of edge that is associated with the segment.
Sourcepub fn next_in_edge_index(&self) -> Option<u16>
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
impl Segment
pub(crate) fn first(&self) -> usize
pub(crate) fn first_point<'a>(&self, points: &'a [Point]) -> &'a Point
pub(crate) fn last(&self) -> usize
pub(crate) fn last_point<'a>(&self, points: &'a [Point]) -> &'a Point
pub(crate) fn edge<'a>(&self, edges: &'a [Edge]) -> Option<&'a Edge>
Sourcepub(crate) fn next_in_edge<'a>(
&self,
segments: &'a [Segment],
) -> Option<&'a Segment>
pub(crate) fn next_in_edge<'a>( &self, segments: &'a [Segment], ) -> Option<&'a Segment>
Returns the next segment in this segment’s parent edge.