Struct gfx_debug_draw::BitmapFont [] [src]

pub struct BitmapFont {
    pub scale_w: u8,
    pub scale_h: u8,
    pub characters: HashMap<char, BitmapCharacter>,
}

Representation of a bitmap font, generated with a tool like BMFont

A BitmapFont describes a bitmap font texture, providing a mapping from character codes to a rectangular area within a corresponding font texture that contains a bitmap representation for that character code.

See http://www.angelcode.com/products/bmfont/doc/file_format.html for more information.

Fields

scale_w
scale_h
characters

Methods

impl BitmapFont

fn from_path(path: &Path) -> Result<BitmapFont, &'static str>

Constructs a BitmapFont for the xml configuration file at the given path

Expects file format like:

<font>
  <common scaleW="128" scaleH="128" ... />
  <chars count="95">
    <char id="32" x="2" y="2" width="0" height="0" xoffset="0" yoffset="14" xadvance="16" ... />
    ...
  </chars>

See http://www.angelcode.com/products/bmfont/doc/file_format.html for more information.

fn from_string(xml_string: &str) -> Result<BitmapFont, &'static str>

Constructs a BitmapFont from the given string

Expects string format like:

<font>
  <common scaleW="128" scaleH="128" ... />
  <chars count="95">
    <char id="32" x="2" y="2" width="0" height="0" xoffset="0" yoffset="14" xadvance="16" ... />
    ...
  </chars>

See http://www.angelcode.com/products/bmfont/doc/file_format.html for more information.