Struct rusttype::FontCollection
[−]
[src]
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>
fn from_bytes<B: Into<SharedBytes<'a>>>(bytes: B) -> FontCollection<'a>
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.
fn into_font(self) -> Option<Font<'a>>
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.
fn font_at(&self, i: usize) -> Option<Font>
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.