Enum ggez::graphics::Font
[−]
[src]
pub enum Font { TTFFont { font: Font<'static>, points: u32, }, 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 (bitmap fonts).
Variants
TTFFont
Fields of TTFFont
font: Font<'static> | |
points: u32 |
BitmapFont
Fields of BitmapFont
surface: Surface<'static> | |
glyphs: BTreeMap<char, u32> | |
glyph_width: u32 |
Methods
impl Font
[src]
fn new<P>(context: &mut Context, path: P, size: u32) -> GameResult<Font> where P: AsRef<Path> + Debug
Load a new TTF font from the given file.
fn new_bitmap<P: AsRef<Path>>(context: &mut Context,
path: P,
glyphs: &str)
-> GameResult<Font>
path: P,
glyphs: &str)
-> GameResult<Font>
Loads an Image
and uses it to create a new bitmap font
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.