Enum ggez::graphics::Font
[−]
[src]
pub enum Font { TTFFont { font: Font, }, BitmapFont { surface: Surface<'static>, glyphs: BTreeMap<char, u32>, glyph_width: u32, }, }
A font that defines the shape of characters drawn on the screen. Can be created from a .ttf file or from an image.
Variants
TTFFont
Fields
font: Font |
BitmapFont
Fields
surface: Surface<'static> | |
glyphs: BTreeMap<char, u32> | |
glyph_width: u32 |
Methods
impl Font
[src]
fn new(context: &mut Context, path: &Path, size: u16) -> GameResult<Font>
Load a new TTF font from the given file.
fn new_bitmap(context: &mut Context, path: &Path, glyphs: &str) -> GameResult<Font>
Create a new bitmap font from a loaded Image
The Image
is a 1D list of glyphs, which maybe isn't
super ideal but should be fine.
The glyphs
string is the characters in the image from left to right.
Takes ownership of the Image
in question.