[][src]Struct bmfont_parser::BMFont

pub struct BMFont {
    pub font_name: String,
    pub size: u32,
    pub info_details: Option<InfoDetails>,
    pub line_height: u32,
    pub common_details: Option<CommonDetails>,
    pub pages: Vec<Page>,
    pub chars: HashMap<u32, BMCharacter>,
}

Loaded and parsed struct of an .sfl file (a bitmap font file).

Fields

font_name: String

The name of the font.

size: u32

Size of the font.

info_details: Option<InfoDetails>

Some details from the Info-block that are not available in all parsing methods

line_height: u32

Line height of the font.

common_details: Option<CommonDetails>

Some details from the Common-block that are not available in all parsing methods

pages: Vec<Page>

The pages of this font

chars: HashMap<u32, BMCharacter>

Hashmap of the characters in the font. <CharID, BMCharacter>

Methods

impl BMFont
[src]

pub fn from_path<T: Into<PathBuf>>(
    format: &Format,
    path: T
) -> Result<BMFont, Error>
[src]

Load and parse a BMFont from the given path, which should be an .sfl file.

Examples

use bmfont_parser::{BMFont, Format};

let bmfont = match BMFont::from_path(&Format::SFL, "examples/fonts/iosevka.sfl") {
    Ok(bmfont) => bmfont,
    Err(_) => panic!("Failed to load iosevka.sfl"),
};

println!("bmfont: {}", bmfont);

pub fn from_loaded<T: Into<String>>(
    format: &Format,
    contents: T,
    image_path: &[&str]
) -> Result<BMFont, Error>
[src]

Load and parse a BMFont from the given String, which should be the contents of an .sfl file.

Examples

use bmfont_parser::{BMFont, Format};

let iosevka_sfl = include_str!("../examples/fonts/iosevka.sfl");

let bmfont = match BMFont::from_loaded(&Format::SFL, iosevka_sfl, &["examples/fonts/iosevka.png"]) {
    Ok(bmfont) => bmfont,
    Err(_) => panic!("Failed to load iosevka.sfl"),
};

println!("bmfont: {}", bmfont);

Trait Implementations

impl Clone for BMFont
[src]

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

Performs copy-assignment from source. Read more

impl Debug for BMFont
[src]

impl Display for BMFont
[src]

Auto Trait Implementations

impl Send for BMFont

impl Sync for BMFont

Blanket Implementations

impl<T> From for T
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.