pub struct Glyph { /* private fields */ }
Expand description
Represents a retrieved glyph from the library
Note that when this glyph is dropped, so is the library
Implementations§
source§impl Glyph
impl Glyph
sourcepub unsafe fn from_raw(library_raw: FT_Library, raw: FT_Glyph) -> Self
pub unsafe fn from_raw(library_raw: FT_Library, raw: FT_Glyph) -> Self
Create a freetype-rs glyph object from c constituent parts
sourcepub fn transform(
&self,
matrix: Option<Matrix>,
delta: Option<Vector>
) -> FtResult<()>
pub fn transform( &self, matrix: Option<Matrix>, delta: Option<Vector> ) -> FtResult<()>
Transform a glyph image if its format is scalable.
sourcepub fn get_cbox(&self, bbox_mode: FT_Glyph_BBox_Mode) -> BBox
pub fn get_cbox(&self, bbox_mode: FT_Glyph_BBox_Mode) -> BBox
Return a glyph’s ‘control box’. The control box encloses all the outline’s points, including Bézier control points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some situations (like when rotating an outline that contains Bézier outside arcs).
Computing the control box is very fast, while getting the bounding box can take much more time as it needs to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component, which is dedicated to this single task.
sourcepub fn to_bitmap(
&self,
render_mode: RenderMode,
origin: Option<Vector>
) -> FtResult<BitmapGlyph>
pub fn to_bitmap( &self, render_mode: RenderMode, origin: Option<Vector> ) -> FtResult<BitmapGlyph>
Convert a given glyph object to a bitmap glyph object.
pub fn stroke(&self, stroker: &Stroker) -> FtResult<Glyph>
pub fn stroke_border(&self, stroker: &Stroker, inside: bool) -> FtResult<Glyph>
pub fn advance_x(&self) -> isize
pub fn advance_y(&self) -> isize
sourcepub fn format(&self) -> FT_Glyph_Format
pub fn format(&self) -> FT_Glyph_Format
An enumeration type used to describe the format of a given glyph image. Note that this version of FreeType only supports two image formats, even though future font drivers will be able to register their own format.
sourcepub fn raw(&self) -> &FT_GlyphRec
pub fn raw(&self) -> &FT_GlyphRec
Get the underlying c glyph struct (The system actually calls this a GlyphRec because it can be a different struct in different circumstances)