Expand description
A basic implememntor for CharacterWidthCache
Implementations
Trait Implementations
sourceimpl<'f, S> CharacterWidthCache for Glyphs<'f, S>where
S: Scalar,
impl<'f, S> CharacterWidthCache for Glyphs<'f, S>where
S: Scalar,
type Scalar = S
type Scalar = S
The scalar type for the width
sourcefn char_width(&mut self, character: char, font_size: u32) -> Self::Scalar
fn char_width(&mut self, character: char, font_size: u32) -> Self::Scalar
Get the width of a character at a font size
sourcefn width(&mut self, text: &str, font_size: u32) -> Self::Scalar
fn width(&mut self, text: &str, font_size: u32) -> Self::Scalar
Get the width of a string at a font_size
sourcefn format_lines(
&mut self,
text: &str,
max_width: Self::Scalar,
format: TextFormat<Self::Scalar>
) -> Vec<String>
fn format_lines(
&mut self,
text: &str,
max_width: Self::Scalar,
format: TextFormat<Self::Scalar>
) -> Vec<String>
Split a string into a list of lines of text with the given format where no line
is wider than the given max width. Newlines (
\n
) in the string are respected Read moresourcefn max_line_width(
&mut self,
text: &str,
max_width: Self::Scalar,
format: TextFormat<Self::Scalar>
) -> Self::Scalar
fn max_line_width(
&mut self,
text: &str,
max_width: Self::Scalar,
format: TextFormat<Self::Scalar>
) -> Self::Scalar
Get the width of the widest line after performing
the calculation of
CharacterWidthCache::format_lines
Read moresourcefn justify_text<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> PositionedLines<R::Vector>where
R: Rectangle<Scalar = Self::Scalar>,
fn justify_text<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> PositionedLines<R::Vector>where
R: Rectangle<Scalar = Self::Scalar>,
Calculate a set of positioned lines of text with the given format
that fit within the given rectangle Read more
sourcefn text_fits_horizontal<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> boolwhere
R: Rectangle<Scalar = Self::Scalar>,
fn text_fits_horizontal<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> boolwhere
R: Rectangle<Scalar = Self::Scalar>,
Check if text with the given format fits within a rectangle’s width
sourcefn text_fits_vertical<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> boolwhere
R: Rectangle<Scalar = Self::Scalar>,
fn text_fits_vertical<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> boolwhere
R: Rectangle<Scalar = Self::Scalar>,
Check if text with the given format fits within a rectangle’s height
sourcefn text_fits<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> boolwhere
R: Rectangle<Scalar = Self::Scalar>,
fn text_fits<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> boolwhere
R: Rectangle<Scalar = Self::Scalar>,
Check if text with the given format fits within a rectangle
sourcefn fit_max_font_size<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> u32where
R: Rectangle<Scalar = Self::Scalar>,
fn fit_max_font_size<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>
) -> u32where
R: Rectangle<Scalar = Self::Scalar>,
Determine the maximum font size for text with the given format
that will still allow the text to fit within a rectangle Read more
sourcefn fit_min_height<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>,
delta: Self::Scalar
) -> Self::Scalarwhere
R: Rectangle<Scalar = Self::Scalar>,
fn fit_min_height<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>,
delta: Self::Scalar
) -> Self::Scalarwhere
R: Rectangle<Scalar = Self::Scalar>,
Determine the minumum height for a rectangle such that text
with the given format will still fit within the rectangle Read more
sourcefn fit_min_width<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>,
delta: Self::Scalar
) -> Self::Scalarwhere
R: Rectangle<Scalar = Self::Scalar>,
fn fit_min_width<R>(
&mut self,
text: &str,
rect: R,
format: TextFormat<Self::Scalar>,
delta: Self::Scalar
) -> Self::Scalarwhere
R: Rectangle<Scalar = Self::Scalar>,
Determine the minumum width for a rectangle such that text
with the given format will still fit within the rectangle Read more
Auto Trait Implementations
impl<'f, S> RefUnwindSafe for Glyphs<'f, S>where
S: RefUnwindSafe,
impl<'f, S> Send for Glyphs<'f, S>where
S: Send,
impl<'f, S> Sync for Glyphs<'f, S>where
S: Sync,
impl<'f, S> Unpin for Glyphs<'f, S>where
S: Unpin,
impl<'f, S> UnwindSafe for Glyphs<'f, S>where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
Sets
value
as a parameter of self
.