Skip to main content

PointFlags

Struct PointFlags 

Source
#[repr(transparent)]
pub struct PointFlags(u8);
Expand description

Flags describing the properties of a point.

Some properties, such as on- and off-curve flags are intrinsic to the point itself. Others, designated as markers are set and cleared while an outline is being transformed during variation application and hinting.

Tuple Fields§

§0: u8

Implementations§

Source§

impl PointFlags

Source

const ON_CURVE: u8

Source

const OFF_CURVE_CUBIC: u8

Source

const CURVE_MASK: u8

Source

pub const fn on_curve() -> Self

Creates a new on curve point flag.

Source

pub const fn off_curve_quad() -> Self

Creates a new off curve quadratic point flag.

Source

pub const fn off_curve_cubic() -> Self

Creates a new off curve cubic point flag.

Source

pub const fn from_bits(bits: u8) -> Self

Creates a point flag from the given bits. These are truncated to ignore markers.

Source

pub const fn is_on_curve(self) -> bool

Returns true if this is an on curve point.

Source

pub const fn is_off_curve_quad(self) -> bool

Returns true if this is an off curve quadratic point.

Source

pub const fn is_off_curve_cubic(self) -> bool

Returns true if this is an off curve cubic point.

Source

pub const fn is_off_curve(self) -> bool

Source

pub fn flip_on_curve(&mut self)

Flips the state of the on curve flag.

This is used for the TrueType FLIPPT instruction.

Source

pub fn set_on_curve(&mut self)

Enables the on curve flag.

This is used for the TrueType FLIPRGON instruction.

Source

pub fn clear_on_curve(&mut self)

Disables the on curve flag.

This is used for the TrueType FLIPRGOFF instruction.

Source

pub fn has_marker(self, marker: PointMarker) -> bool

Returns true if the given marker is set for this point.

Source

pub fn set_marker(&mut self, marker: PointMarker)

Applies the given marker to this point.

Source

pub fn clear_marker(&mut self, marker: PointMarker)

Clears the given marker for this point.

Source

pub const fn without_markers(self) -> Self

Returns a copy with all markers cleared.

Source

pub const fn to_bits(self) -> u8

Returns the underlying bits.

Trait Implementations§

Source§

impl AnyBitPattern for PointFlags

Source§

impl Clone for PointFlags

Source§

fn clone(&self) -> PointFlags

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for PointFlags

Source§

impl Debug for PointFlags

Source§

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

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

impl Default for PointFlags

Source§

fn default() -> PointFlags

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

impl Eq for PointFlags

Source§

impl NoUninit for PointFlags

Source§

impl PartialEq for PointFlags

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PointFlags

Source§

impl Zeroable for PointFlags

Source§

fn zeroed() -> Self

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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> ErasedDestructor for T
where T: 'static,

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.