[][src]Struct bmfont::BMFont

pub struct BMFont { /* fields omitted */ }

Holds a decoded bitmap font defintion, including all character advance and kerning values.

Implementations

impl BMFont[src]

pub fn new<R>(
    source: R,
    ordinate_orientation: OrdinateOrientation
) -> Result<BMFont, Error> where
    R: Read
[src]

Constructs a new BMFont.

Examples

From a file:

let file = std::fs::File::open("font.fnt")?;
let font = BMFont::new(file, OrdinateOrientation::TopToBottom)?;
assert_eq!(font.line_height(), 80);

From a slice of bytes:

let data = std::io::Cursor::new(my_font_bytes);
let font = BMFont::new(data, OrdinateOrientation::TopToBottom)?;
assert_eq!(font.line_height(), 80);

pub fn base_height(&self) -> u32[src]

Returns the height of a EM in pixels.

pub fn line_height(&self) -> u32[src]

pub fn pages(&self) -> PageIter<'_>

Notable traits for PageIter<'a>

impl<'a> Iterator for PageIter<'a> type Item = &'a str;
[src]

Returns an Iterator of font page bitmap filenames.

Examples

let file = std::fs::File::open("font.fnt")?;
let font = BMFont::new(file, OrdinateOrientation::TopToBottom)?;
assert_eq!(font.pages().next(), Some("font.png"));

pub fn parse<'s>(&'s self, s: &'s str) -> Parse<'s>[src]

Trait Implementations

impl Clone for BMFont[src]

impl Debug for BMFont[src]

impl<'de> Deserialize<'de> for BMFont[src]

impl Serialize for BMFont[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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, 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.