Struct cosmic_text::ShapeGlyph
source · pub struct ShapeGlyph {Show 15 fields
pub start: usize,
pub end: usize,
pub x_advance: f32,
pub y_advance: f32,
pub x_offset: f32,
pub y_offset: f32,
pub ascent: f32,
pub descent: f32,
pub font_monospace_em_width: Option<f32>,
pub font_id: ID,
pub glyph_id: u16,
pub color_opt: Option<Color>,
pub metadata: usize,
pub cache_key_flags: CacheKeyFlags,
pub metrics_opt: Option<Metrics>,
}
Expand description
A shaped glyph
Fields§
§start: usize
§end: usize
§x_advance: f32
§y_advance: f32
§x_offset: f32
§y_offset: f32
§ascent: f32
§descent: f32
§font_monospace_em_width: Option<f32>
§font_id: ID
§glyph_id: u16
§color_opt: Option<Color>
§metadata: usize
§cache_key_flags: CacheKeyFlags
§metrics_opt: Option<Metrics>
Implementations§
source§impl ShapeGlyph
impl ShapeGlyph
sourcepub fn width(&self, font_size: f32) -> f32
pub fn width(&self, font_size: f32) -> f32
Get the width of the ShapeGlyph
in pixels, either using the provided font size
or the ShapeGlyph::metrics_opt
override.
Trait Implementations§
source§impl Clone for ShapeGlyph
impl Clone for ShapeGlyph
source§fn clone(&self) -> ShapeGlyph
fn clone(&self) -> ShapeGlyph
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 moreAuto Trait Implementations§
impl Freeze for ShapeGlyph
impl RefUnwindSafe for ShapeGlyph
impl Send for ShapeGlyph
impl Sync for ShapeGlyph
impl Unpin for ShapeGlyph
impl UnwindSafe for ShapeGlyph
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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>
Converts
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>
Converts
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