Struct GlyphMetrics
pub struct GlyphMetrics<'a> { /* private fields */ }Expand description
Glyph specific metrics.
Implementations§
§impl<'a> GlyphMetrics<'a>
impl<'a> GlyphMetrics<'a>
pub fn new(
font: &FontRef<'a>,
size: Size,
location: impl Into<LocationRef<'a>>,
) -> GlyphMetrics<'a>
pub fn new( font: &FontRef<'a>, size: Size, location: impl Into<LocationRef<'a>>, ) -> GlyphMetrics<'a>
Creates new glyph metrics from the given font, size, and location in normalized variation space.
pub fn glyph_count(&self) -> u32
pub fn glyph_count(&self) -> u32
Returns the number of available glyphs in the font.
pub fn advance_width(&self, glyph_id: GlyphId) -> Option<f32>
pub fn advance_width(&self, glyph_id: GlyphId) -> Option<f32>
Returns the advance width for the specified glyph.
If normalized coordinates were provided when constructing glyph metrics and
an HVAR table is present, applies the appropriate delta.
Returns None if glyph_id >= self.glyph_count() or the underlying font
data is invalid.
pub fn left_side_bearing(&self, glyph_id: GlyphId) -> Option<f32>
pub fn left_side_bearing(&self, glyph_id: GlyphId) -> Option<f32>
Returns the left side bearing for the specified glyph.
If normalized coordinates were provided when constructing glyph metrics and
an HVAR table is present, applies the appropriate delta.
Returns None if glyph_id >= self.glyph_count() or the underlying font
data is invalid.
pub fn bounds(&self, glyph_id: GlyphId) -> Option<BoundingBox<f32>>
pub fn bounds(&self, glyph_id: GlyphId) -> Option<BoundingBox<f32>>
Returns the bounding box for the specified glyph.
Returns None if glyph_id >= self.glyph_count(), the underlying font
data is invalid.
Trait Implementations§
§impl<'a> Clone for GlyphMetrics<'a>
impl<'a> Clone for GlyphMetrics<'a>
§fn clone(&self) -> GlyphMetrics<'a>
fn clone(&self) -> GlyphMetrics<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for GlyphMetrics<'a>
impl<'a> RefUnwindSafe for GlyphMetrics<'a>
impl<'a> Send for GlyphMetrics<'a>
impl<'a> Sync for GlyphMetrics<'a>
impl<'a> Unpin for GlyphMetrics<'a>
impl<'a> UnsafeUnpin for GlyphMetrics<'a>
impl<'a> UnwindSafe for GlyphMetrics<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more