[−][src]Struct bmfont::BMFont
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]
source: R,
ordinate_orientation: OrdinateOrientation
) -> Result<BMFont, Error> where
R: Read,
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<'_>ⓘ
[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]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for BMFont
[src]
Auto Trait Implementations
impl RefUnwindSafe for BMFont
[src]
impl Send for BMFont
[src]
impl Sync for BMFont
[src]
impl Unpin for BMFont
[src]
impl UnwindSafe for BMFont
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,