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_kurbo(path: &BezPath) -> Result<Self, BadKurbo>
pub fn from_kurbo(path: &BezPath) -> Result<Self, BadKurbo>
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.
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
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for SimpleGlyph
impl Debug 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)
Write our data and information about offsets into this TableWriter.
fn name(&self) -> &'static str
source§impl Validate for SimpleGlyph
impl Validate for SimpleGlyph
source§fn validate_impl(&self, ctx: &mut ValidationCtx)
fn validate_impl(&self, ctx: &mut ValidationCtx)
Validate this table. Read more
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
Mutably borrows from an owned value. Read more
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
Convert this type into
T, using the provided data to resolve any offsets.