[−][src]Struct pane::Glyphs
A basic implememntor for CharacterWidthCache
Methods
impl<'f, S> Glyphs<'f, S> where
S: Scalar,
[src]
S: Scalar,
pub fn from_bytes(bytes: &'f [u8]) -> Result<Glyphs<'f, S>, Error>
[src]
Loads a Glyphs
from an array of font data.
pub fn from_font(font: Font<'f>) -> Glyphs<'f, S>
[src]
Loads a Glyphs
from a Font
.
Trait Implementations
impl<'f, S> CharacterWidthCache for Glyphs<'f, S> where
S: Scalar,
[src]
S: Scalar,
type Scalar = S
The scalar type for the width
fn char_width(&mut self, character: char, font_size: u32) -> Self::Scalar
[src]
fn width(&mut self, text: &str, font_size: u32) -> Self::Scalar
[src]
Get the width of a string at a font_size
fn format_lines<F>(
&mut self,
text: &str,
max_width: Self::Scalar,
format: F
) -> Vec<String> where
F: Into<TextFormat<Self::Scalar>>,
[src]
&mut self,
text: &str,
max_width: Self::Scalar,
format: F
) -> Vec<String> where
F: Into<TextFormat<Self::Scalar>>,
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<F>(
&mut self,
text: &str,
max_width: Self::Scalar,
format: F
) -> Self::Scalar where
F: Into<TextFormat<Self::Scalar>>,
[src]
&mut self,
text: &str,
max_width: Self::Scalar,
format: F
) -> Self::Scalar where
F: Into<TextFormat<Self::Scalar>>,
Get the width of the widest line after performing the calculation of CharacterWidthCache::format_lines
Read more
fn justify_text<R, F>(
&mut self,
text: &str,
rect: R,
format: F
) -> PositionedLines<R::Vector> where
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
[src]
&mut self,
text: &str,
rect: R,
format: F
) -> PositionedLines<R::Vector> where
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
Calculate a set of positioned lines of text 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<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
[src]
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
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<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
[src]
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
Check if text with the given format fits within a rectangle's height
fn text_fits<R, F>(&mut self, text: &str, rect: R, format: F) -> bool where
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
[src]
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
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<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
[src]
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<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
fn fit_min_height<R, F>(
&mut self,
text: &str,
rect: R,
format: F,
delta: Self::Scalar
) -> Self::Scalar where
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
[src]
&mut self,
text: &str,
rect: R,
format: F,
delta: Self::Scalar
) -> Self::Scalar where
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
Determine the minumum height for a rectangle such that text with the given format will still fit within the rectangle Read more
fn fit_min_width<R, F>(
&mut self,
text: &str,
rect: R,
format: F,
delta: Self::Scalar
) -> Self::Scalar where
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
[src]
&mut self,
text: &str,
rect: R,
format: F,
delta: Self::Scalar
) -> Self::Scalar where
R: Rectangle<Scalar = Self::Scalar>,
F: Into<TextFormat<Self::Scalar>>,
Determine the minumum width for a rectangle such that text with the given format will still fit within the rectangle Read more
impl<'f, S: Clone> Clone for Glyphs<'f, S> where
S: Scalar,
[src]
S: Scalar,
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,