pub struct SimpleGlyph<'a> {
data: FontData<'a>,
}Expand description
The Glyph Header
Fields§
§data: FontData<'a>Implementations§
Source§impl<'a> SimpleGlyph<'a>
impl<'a> SimpleGlyph<'a>
pub const MIN_SIZE: usize
Sourcepub fn resolve_offset<O: Offset, R: FontRead<'a>>(
&self,
offset: O,
) -> Result<R, ReadError>
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.
Sourcepub fn offset_data(&self) -> FontData<'a>
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.
Sourcepub fn shape(&self) -> &Self
👎Deprecated: just use the base type directly
pub fn shape(&self) -> &Self
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.
Sourcepub fn number_of_contours(&self) -> i16
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.
Sourcepub fn end_pts_of_contours(&self) -> &'a [BigEndian<u16>]
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
Sourcepub fn instruction_length(&self) -> u16
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.
Sourcepub fn instructions(&self) -> &'a [u8] ⓘ
pub fn instructions(&self) -> &'a [u8] ⓘ
Array of instruction byte code for the glyph.
Sourcepub fn glyph_data(&self) -> &'a [u8] ⓘ
pub fn glyph_data(&self) -> &'a [u8] ⓘ
the raw data for flags & x/y coordinates
pub fn number_of_contours_byte_range(&self) -> Range<usize> ⓘ
pub fn x_min_byte_range(&self) -> Range<usize> ⓘ
pub fn y_min_byte_range(&self) -> Range<usize> ⓘ
pub fn x_max_byte_range(&self) -> Range<usize> ⓘ
pub fn y_max_byte_range(&self) -> Range<usize> ⓘ
pub fn end_pts_of_contours_byte_range(&self) -> Range<usize> ⓘ
pub fn instruction_length_byte_range(&self) -> Range<usize> ⓘ
pub fn instructions_byte_range(&self) -> Range<usize> ⓘ
pub fn glyph_data_byte_range(&self) -> Range<usize> ⓘ
Source§impl<'a> SimpleGlyph<'a>
impl<'a> SimpleGlyph<'a>
Sourcepub fn num_points(&self) -> usize
pub fn num_points(&self) -> usize
Returns the total number of points.
Sourcepub fn has_overlapping_contours(&self) -> bool
pub fn has_overlapping_contours(&self) -> bool
Returns true if the contours in the simple glyph may overlap.
Sourcepub fn read_points_fast<C: PointCoord>(
&self,
points: &mut [Point<C>],
flags: &mut [PointFlags],
) -> Result<(), ReadError>
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.
Sourcepub fn points(&self) -> impl Iterator<Item = CurvePoint> + 'a + Clone
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.
fn points_impl(&self) -> Option<PointIter<'a>>
Trait Implementations§
Source§impl<'a> Clone for SimpleGlyph<'a>
impl<'a> Clone for SimpleGlyph<'a>
Source§fn clone(&self) -> SimpleGlyph<'a>
fn clone(&self) -> SimpleGlyph<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more