[][src]Struct pane::Glyphs

pub struct Glyphs<'f, S = f64> where
    S: Scalar
{ /* fields omitted */ }

A basic implememntor for CharacterWidthCache

Methods

impl<'f, S> Glyphs<'f, S> where
    S: Scalar
[src]

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]

type Scalar = S

The scalar type for the width

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<'f, S> Send for Glyphs<'f, S> where
    S: Send

impl<'f, S> Sync for Glyphs<'f, S> where
    S: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.