[][src]Struct rusttype::FontCollection

pub struct FontCollection<'a>(_);

A collection of fonts read straight from a font file's data. The data in the collection is not validated. This structure may or may not own the font data.

Methods

impl<'a> FontCollection<'a>[src]

pub fn from_bytes<B: Into<SharedBytes<'a>>>(bytes: B) -> FontCollection<'a>[src]

Constructs a font collection from an array of bytes, typically loaded from a font file. This array may be owned (e.g. Vec<u8>), or borrowed (&[u8]). As long as From<T> is implemented for Bytes for some type T, T can be used as input.

pub fn into_font(self) -> Option<Font<'a>>[src]

In the common case that a font collection consists of only one font, this function consumes this font collection and turns it into a font. If this is not the case, or the font is not valid (read: not supported by this library), None is returned.

pub fn font_at(&self, i: usize) -> Option<Font<'a>>[src]

Gets the font at index i in the font collection, if it exists and is valid. The produced font borrows the font data that is either borrowed or owned by this font collection.

Important traits for IntoFontsIter<'a>
pub fn into_fonts(self) -> IntoFontsIter<'a>[src]

Converts self into an Iterator yielding each Font that exists within the collection.

Trait Implementations

impl<'a> Clone for FontCollection<'a>[src]

impl<'a> Debug for FontCollection<'a>[src]

Auto Trait Implementations

impl<'a> Sync for FontCollection<'a>

impl<'a> Send for FontCollection<'a>

impl<'a> Unpin for FontCollection<'a>

impl<'a> UnwindSafe for FontCollection<'a>

impl<'a> RefUnwindSafe for FontCollection<'a>

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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