Struct write_fonts::tables::glyf::SimpleGlyph
source · pub struct SimpleGlyph {
pub bbox: Bbox,
/* private fields */
}Expand description
A simple (without components) glyph
Fields§
§bbox: BboxImplementations§
source§impl SimpleGlyph
impl SimpleGlyph
sourcepub fn from_bezpath(path: &BezPath) -> Result<Self, MalformedPath>
pub fn from_bezpath(path: &BezPath) -> Result<Self, MalformedPath>
Attempt to create a simple glyph from a kurbo BezPath
The path may contain only line and quadratic bezier segments. The caller is responsible for converting any cubic segments to quadratics before calling.
Returns an error if the input path is malformed; that is, if it is empty, contains cubic segments, or does not begin with a ‘move’ instruction.
Context
- In the glyf table simple (contour based) glyph paths implicitly close when rendering.
- In font sources, and svg, open and closed paths are distinct.
- In SVG closure matters due to influence on strokes, https://www.w3.org/TR/SVG11/paths.html#PathDataClosePathCommand.
- An explicit closePath joins the first/last points of a contour
- This is not the same as ending with some other drawing command whose endpoint is the contour startpoint
- In FontTools endPath says I’m done with this subpath, BezPath has no endPath.
Context courtesy of @anthrotype.
sourcepub fn interpolatable_glyphs_from_bezpaths(
paths: &[BezPath]
) -> Result<Vec<Self>, MalformedPath>
pub fn interpolatable_glyphs_from_bezpaths( paths: &[BezPath] ) -> Result<Vec<Self>, MalformedPath>
Attempt to create a set of interpolation-compatible glyphs from a set of paths.
The paths are expected to be preprocessed, and interpolation compatible (i.e. they should have the same number and type of points, in the same order.) They should contain only line and quadratic segments; the caller is responsible for converting cubics to quadratics as needed.
This method is provided for use when compiling variable fonts. The inputs are expected to be different instances of the same named glyph, each corresponding to a different location in the variation space.
pub fn contours(&self) -> &[Contour]
Trait Implementations§
source§impl Clone for SimpleGlyph
impl Clone for SimpleGlyph
source§fn clone(&self) -> SimpleGlyph
fn clone(&self) -> SimpleGlyph
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SimpleGlyph
impl Debug for SimpleGlyph
source§impl<'a> FontRead<'a> for SimpleGlyph
impl<'a> FontRead<'a> for SimpleGlyph
source§impl FontWrite for SimpleGlyph
impl FontWrite for SimpleGlyph
source§fn write_into(&self, writer: &mut TableWriter)
fn write_into(&self, writer: &mut TableWriter)
source§fn table_type(&self) -> TableType
fn table_type(&self) -> TableType
source§impl From<SimpleGlyph> for Glyph
impl From<SimpleGlyph> for Glyph
source§fn from(value: SimpleGlyph) -> Self
fn from(value: SimpleGlyph) -> Self
source§impl PartialEq for SimpleGlyph
impl PartialEq for SimpleGlyph
source§fn eq(&self, other: &SimpleGlyph) -> bool
fn eq(&self, other: &SimpleGlyph) -> bool
self and other values to be equal, and is used
by ==.source§impl SomeGlyph for SimpleGlyph
impl SomeGlyph for SimpleGlyph
source§impl Validate for SimpleGlyph
impl Validate for SimpleGlyph
source§fn validate_impl(&self, ctx: &mut ValidationCtx)
fn validate_impl(&self, ctx: &mut ValidationCtx)
impl Eq for SimpleGlyph
impl StructuralEq for SimpleGlyph
impl StructuralPartialEq for SimpleGlyph
Auto Trait Implementations§
impl RefUnwindSafe for SimpleGlyph
impl Send for SimpleGlyph
impl Sync for SimpleGlyph
impl Unpin for SimpleGlyph
impl UnwindSafe for SimpleGlyph
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<'a, T> FontReadWithArgs<'a> for Twhere
T: FontRead<'a>,
impl<'a, T> FontReadWithArgs<'a> for Twhere
T: FontRead<'a>,
source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.