Struct fit_text::BasicGlyphs [−][src]
pub struct BasicGlyphs<'f> { /* fields omitted */ }
Expand description
A basic implementor for CharacterWidthCache
Implementations
Loads a Glyphs
from an array of font data.
Loads a Glyphs
from a Font
.
Trait Implementations
Get the width of a character at a font size
fn format_lines<S, F>(
&mut self,
text: S,
max_width: f64,
format: F
) -> Vec<String> where
S: AsRef<str>,
F: Into<TextFormat>,
fn format_lines<S, F>(
&mut self,
text: S,
max_width: f64,
format: F
) -> Vec<String> where
S: AsRef<str>,
F: Into<TextFormat>,
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 more
fn max_line_width<S, F>(&mut self, text: S, max_width: f64, format: F) -> f64 where
S: AsRef<str>,
F: Into<TextFormat>,
fn max_line_width<S, F>(&mut self, text: S, max_width: f64, format: F) -> f64 where
S: AsRef<str>,
F: Into<TextFormat>,
Get the width of the widest line after performing
the calculation of CharacterWidthCache::format_lines
Read more
fn justify_text<S, R, F>(
&mut self,
text: S,
rect: R,
format: F
) -> PositionedLines<R::Vector> where
S: AsRef<str>,
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
fn justify_text<S, R, F>(
&mut self,
text: S,
rect: R,
format: F
) -> PositionedLines<R::Vector> where
S: AsRef<str>,
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
Calculate a set of positioned lines of text with the given format that fit within the given rectangle Read more
fn justify_meta_fragments<I, M, S, R, F>(
&mut self,
fragments: I,
rect: R,
format: F
) -> PositionedLinesMeta<R::Vector, M> where
I: IntoIterator<Item = (S, M)>,
M: Clone,
S: AsRef<str>,
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
fn justify_meta_fragments<I, M, S, R, F>(
&mut self,
fragments: I,
rect: R,
format: F
) -> PositionedLinesMeta<R::Vector, M> where
I: IntoIterator<Item = (S, M)>,
M: Clone,
S: AsRef<str>,
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
Calculate a set of positioned text and metadata lines with the given format that fit within the given rectangle Read more
fn text_fits_horizontal<R, F>(&mut self, text: &str, rect: R, format: F) -> bool where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
fn text_fits_horizontal<R, F>(&mut self, text: &str, rect: R, format: F) -> bool where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
Check if text with the given format fits within a rectangle’s width
fn text_fits_vertical<R, F>(&mut self, text: &str, rect: R, format: F) -> bool where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
fn text_fits_vertical<R, F>(&mut self, text: &str, rect: R, format: F) -> bool where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
Check if text with the given format fits within a rectangle’s height
Check if text with the given format fits within a rectangle
fn fit_max_font_size<R, F>(&mut self, text: &str, rect: R, format: F) -> u32 where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
fn fit_max_font_size<R, F>(&mut self, text: &str, rect: R, format: F) -> u32 where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
Determine the maximum font size for text with the given format that will still allow the text to fit within a rectangle Read more
Determine the minumum height for a rectangle such that text with the given format will still fit within the rectangle Read more
Determine the minumum width for a rectangle such that text with the given format will still fit within the rectangle Read more
fn ideal_text_size<R, F>(
&mut self,
text: &str,
rect: R,
format: F
) -> TextFormat where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
fn ideal_text_size<R, F>(
&mut self,
text: &str,
rect: R,
format: F
) -> TextFormat where
R: Rectangle,
R::Vector: Vector2<Scalar = f64>,
F: Into<TextFormat>,
Determine the correct text size based on the given TextFormat
Auto Trait Implementations
impl<'f> RefUnwindSafe for BasicGlyphs<'f>
impl<'f> Send for BasicGlyphs<'f>
impl<'f> Sync for BasicGlyphs<'f>
impl<'f> Unpin for BasicGlyphs<'f>
impl<'f> UnwindSafe for BasicGlyphs<'f>
Blanket Implementations
Mutably borrows from an owned value. Read more