Type Alias read_fonts::tables::glyf::SimpleGlyph

source ·
pub type SimpleGlyph<'a> = TableRef<'a, SimpleGlyphMarker>;
Expand description

Aliased Type§

struct SimpleGlyph<'a> { /* private fields */ }

Implementations§

source§

impl<'a> SimpleGlyph<'a>

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§

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.

Trait Implementations§

source§

impl<'a> Debug for SimpleGlyph<'a>

source§

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

Formats the value using the given formatter. 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> SomeTable<'a> for SimpleGlyph<'a>

source§

fn type_name(&self) -> &str

The name of this table
source§

fn get_field(&self, idx: usize) -> Option<Field<'a>>

Access this table’s fields, in declaration order.