Struct freetype::glyph_slot::GlyphSlot
source · [−]pub struct GlyphSlot { /* private fields */ }
Expand description
A struct encapsulating the space for a glyph within a Library
Implementations
sourceimpl GlyphSlot
impl GlyphSlot
sourcepub unsafe fn from_raw(library_raw: FT_Library, raw: FT_GlyphSlot) -> Self
pub unsafe fn from_raw(library_raw: FT_Library, raw: FT_GlyphSlot) -> Self
Create a GlyphSlot
from its constituent C parts
sourcepub fn render_glyph(&self, render_mode: RenderMode) -> FtResult<()>
pub fn render_glyph(&self, render_mode: RenderMode) -> FtResult<()>
Convert a given glyph image to a bitmap. It does so by inspecting the glyph image format, finding the relevant renderer, and invoking it.
sourcepub fn get_subglyph_info(&self, sub_index: u32) -> FtResult<SubGlyphInfo>
pub fn get_subglyph_info(&self, sub_index: u32) -> FtResult<SubGlyphInfo>
Retrieve a description of a given subglyph. Only use it if the glyph’s format is FT_GLYPH_FORMAT_COMPOSITE; an error is returned otherwise.
sourcepub fn get_glyph(&self) -> FtResult<Glyph>
pub fn get_glyph(&self) -> FtResult<Glyph>
Returns a glyph object, that is similar to a GlyphSlot
but managed outside of the library
sourcepub fn outline(&self) -> Option<Outline<'_>>
pub fn outline(&self) -> Option<Outline<'_>>
In freetype, the Outline
object is a scalable glyph. This method unpacks a glyph into
this object, or returns None
if the glyph has no outline
sourcepub fn bitmap(&self) -> Bitmap
pub fn bitmap(&self) -> Bitmap
This field is used as a bitmap descriptor when the slot format is FT_GLYPH_FORMAT_BITMAP. Note that the address and content of the bitmap buffer can change between calls of FT_Load_Glyph and a few other functions.
sourcepub fn bitmap_left(&self) -> i32
pub fn bitmap_left(&self) -> i32
The bitmap’s left bearing expressed in integer pixels. Only valid if the format is FT_GLYPH_FORMAT_BITMAP, this is, if the glyph slot contains a bitmap.
sourcepub fn bitmap_top(&self) -> i32
pub fn bitmap_top(&self) -> i32
The bitmap’s top bearing expressed in integer pixels. Remember that this is the distance from the baseline to the top-most glyph scanline, upwards y coordinates being positive.
sourcepub fn advance(&self) -> Vector
pub fn advance(&self) -> Vector
This shorthand is, depending on FT_LOAD_IGNORE_TRANSFORM, the transformed (hinted) advance width for the glyph, in 26.6 fractional pixel format. As specified with FT_LOAD_VERTICAL_LAYOUT, it uses either the ‘horiAdvance’ or the ‘vertAdvance’ value of ‘metrics’ field.
sourcepub fn linear_hori_advance(&self) -> FT_Fixed
pub fn linear_hori_advance(&self) -> FT_Fixed
The advance width of the unhinted glyph. Its value is expressed in 16.16 fractional pixels, unless FT_LOAD_LINEAR_DESIGN is set when loading the glyph. This field can be important to perform correct WYSIWYG layout. Only relevant for outline glyphs.
sourcepub fn linear_vert_advance(&self) -> FT_Fixed
pub fn linear_vert_advance(&self) -> FT_Fixed
The advance height of the unhinted glyph. Its value is expressed in 16.16 fractional pixels, unless FT_LOAD_LINEAR_DESIGN is set when loading the glyph. This field can be important to perform correct WYSIWYG layout. Only relevant for outline glyphs.
sourcepub fn metrics(&self) -> GlyphMetrics
pub fn metrics(&self) -> GlyphMetrics
The metrics of the last loaded glyph in the slot. The returned values depend on the last load flags (see the FT_Load_Glyph API function) and can be expressed either in 26.6 fractional pixels or font units.
sourcepub fn raw(&self) -> &FT_GlyphSlotRec
pub fn raw(&self) -> &FT_GlyphSlotRec
Get a pointer to the underlying c struct
Trait Implementations
impl Copy for GlyphSlot
impl Eq for GlyphSlot
impl StructuralEq for GlyphSlot
impl StructuralPartialEq for GlyphSlot
Auto Trait Implementations
impl RefUnwindSafe for GlyphSlot
impl !Send for GlyphSlot
impl !Sync for GlyphSlot
impl Unpin for GlyphSlot
impl UnwindSafe for GlyphSlot
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more