Struct glerminal::font::Font
[−]
[src]
pub struct Font { pub name: String, pub line_height: u32, pub size: u32, // some fields omitted }
Represents the font when it's loaded.
Fields
name: String
The name of the font
line_height: u32
Line height of the font
size: u32
Size of the font (width)
Methods
impl Font
[src]
pub fn load<T: Into<PathBuf>>(fnt_path: T) -> Font
[src]
Loads the font fron the given .sfl file, for example:
use glerminal::font::Font; let font = Font::load("fonts/iosevka.sfl");
pub fn load_raw<T: Into<String>, R: Read>(sfl_content: T, image_read: R) -> Font
[src]
Loads the font from the given string (.sfl file contents) and Read (image read)
use glerminal::font::Font; use std::fs::File; let font = Font::load_raw(include_str!("../fonts/iosevka.sfl"), File::open("fonts/iosevka.png").unwrap());
pub fn get_character(&self, character: char) -> Result<CharacterData, String>
[src]
Gets the CharacterData from the Font with the given char, if the charcter exists, otherwise returns an error as a String. Example:
use glerminal::font::Font; let a_char_data = Font::load("fonts/iosevka.sfl").get_character('a');
Trait Implementations
impl Debug for Font
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more