pub struct StrokeFont<'a> {
pub line_height: f32,
pub height: f32,
pub cap_height: f32,
pub advance: i8,
pub positions: &'a [[i8; 2]],
pub strokes: &'a [Range<usize>],
pub glyphs: &'a [(i8, Range<usize>); 95],
}Expand description
A stroke font containing glyphs for the 95 printable ASCII codes.
Fields§
§line_height: f32Baseline-to-baseline line height ratio.
height: f32Full glyph height (cap + descender) in font units.
cap_height: f32Cap height in font units.
advance: i8Advance used for unsupported glyphs.
positions: &'a [[i8; 2]]Raw glyph point positions.
strokes: &'a [Range<usize>]Stroke ranges into positions.
glyphs: &'a [(i8, Range<usize>); 95]Glyph advances and stroke ranges.
Implementations§
Source§impl<'a> StrokeFont<'a>
impl<'a> StrokeFont<'a>
Sourcepub fn layout(
&'a self,
sections: &'a [(&'a str, Color)],
font_size: f32,
) -> StrokeTextLayout<'a>
pub fn layout( &'a self, sections: &'a [(&'a str, Color)], font_size: f32, ) -> StrokeTextLayout<'a>
Builds a StrokeTextLayout for sections at the requested font_size.
Sourcepub fn get_glyph(&self, c: char) -> Option<(i8, Range<usize>)>
pub fn get_glyph(&self, c: char) -> Option<(i8, Range<usize>)>
Get the advance and stroke point ranges for a glyph.
Sourcepub fn get_glyph_advance(&self, c: char) -> Option<i8>
pub fn get_glyph_advance(&self, c: char) -> Option<i8>
Get the advance for a glyph.
Auto Trait Implementations§
impl<'a> Freeze for StrokeFont<'a>
impl<'a> RefUnwindSafe for StrokeFont<'a>
impl<'a> Send for StrokeFont<'a>
impl<'a> Sync for StrokeFont<'a>
impl<'a> Unpin for StrokeFont<'a>
impl<'a> UnsafeUnpin for StrokeFont<'a>
impl<'a> UnwindSafe for StrokeFont<'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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.