Skip to main content

SimpleGlyph

Struct SimpleGlyph 

Source
pub struct SimpleGlyph<'a> {
    data: FontData<'a>,
}
Expand description

Fields§

§data: FontData<'a>

Implementations§

Source§

impl<'a> SimpleGlyph<'a>

Source

pub const MIN_SIZE: usize

Source

pub fn resolve_offset<O: Offset, R: FontRead<'a>>( &self, offset: O, ) -> Result<R, ReadError>

Resolve the provided offset from the start of this table.

Source

pub fn offset_data(&self) -> FontData<'a>

Return a reference to this table’s raw data.

We use this in the compile crate to resolve offsets.

Source

pub fn shape(&self) -> &Self

👎Deprecated: just use the base type directly

Return a reference to the table’s ‘Shape’ struct.

This is a low level implementation detail, but it can be useful in some cases where you want to know things about a table’s layout, such as the byte offsets of specific fields.

Source

pub fn number_of_contours(&self) -> i16

If the number of contours is greater than or equal to zero, this is a simple glyph. If negative, this is a composite glyph — the value -1 should be used for composite glyphs.

Source

pub fn x_min(&self) -> i16

Minimum x for coordinate data.

Source

pub fn y_min(&self) -> i16

Minimum y for coordinate data.

Source

pub fn x_max(&self) -> i16

Maximum x for coordinate data.

Source

pub fn y_max(&self) -> i16

Maximum y for coordinate data.

Source

pub fn end_pts_of_contours(&self) -> &'a [BigEndian<u16>]

Array of point indices for the last point of each contour, in increasing numeric order

Source

pub fn instruction_length(&self) -> u16

Total number of bytes for instructions. If instructionLength is zero, no instructions are present for this glyph, and this field is followed directly by the flags field.

Source

pub fn instructions(&self) -> &'a [u8]

Array of instruction byte code for the glyph.

Source

pub fn glyph_data(&self) -> &'a [u8]

the raw data for flags & x/y coordinates

Source

pub fn number_of_contours_byte_range(&self) -> Range<usize>

Source

pub fn x_min_byte_range(&self) -> Range<usize>

Source

pub fn y_min_byte_range(&self) -> Range<usize>

Source

pub fn x_max_byte_range(&self) -> Range<usize>

Source

pub fn y_max_byte_range(&self) -> Range<usize>

Source

pub fn end_pts_of_contours_byte_range(&self) -> Range<usize>

Source

pub fn instruction_length_byte_range(&self) -> Range<usize>

Source

pub fn instructions_byte_range(&self) -> Range<usize>

Source

pub fn glyph_data_byte_range(&self) -> Range<usize>

Source§

impl<'a> SimpleGlyph<'a>

Source

pub fn num_points(&self) -> usize

Returns the total number of points.

Source

pub fn has_overlapping_contours(&self) -> bool

Returns true if the contours in the simple glyph may overlap.

Source

pub fn read_points_fast<C: PointCoord>( &self, points: &mut [Point<C>], flags: &mut [PointFlags], ) -> Result<(), ReadError>

Reads points and flags into the provided buffers.

Drops all flag bits except on-curve. The lengths of the buffers must be equal to the value returned by num_points.

§Performance

As the name implies, this is faster than using the iterator returned by points so should be used when it is possible to preallocate buffers.

Source

pub fn points(&self) -> impl Iterator<Item = CurvePoint> + 'a + Clone

Returns an iterator over the points in the glyph.

§Performance

This is slower than read_points_fast but provides access to the points without requiring a preallocated buffer.

Source

fn points_impl(&self) -> Option<PointIter<'a>>

Trait Implementations§

Source§

impl<'a> Clone for SimpleGlyph<'a>

Source§

fn clone(&self) -> SimpleGlyph<'a>

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<'a> FontRead<'a> for SimpleGlyph<'a>

Source§

fn read(data: FontData<'a>) -> Result<Self, ReadError>

Read an instance of Self from the provided data, performing validation. Read more
Source§

impl<'a> MinByteRange<'a> for SimpleGlyph<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for SimpleGlyph<'a>

§

impl<'a> RefUnwindSafe for SimpleGlyph<'a>

§

impl<'a> Send for SimpleGlyph<'a>

§

impl<'a> Sync for SimpleGlyph<'a>

§

impl<'a> Unpin for SimpleGlyph<'a>

§

impl<'a> UnsafeUnpin for SimpleGlyph<'a>

§

impl<'a> UnwindSafe for SimpleGlyph<'a>

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<'a, T> FontReadWithArgs<'a> for T
where T: FontRead<'a>,

Source§

fn read_with_args( data: FontData<'a>, _: &<T as ReadArgs>::Args, ) -> Result<T, ReadError>

read an item, using the provided args. 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<'a, T> ReadArgs for T
where T: FontRead<'a>,

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.