Enum ggez::graphics::Font [] [src]

pub enum Font {
    TTFFont {
        font: Font<'static>,
        points: u32,
        scale: Scale,
    },
    BitmapFont {
        bytes: Vec<u8>,
        width: usize,
        height: usize,
        glyphs: BTreeMap<char, usize>,
        glyph_width: usize,
    },
}

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

Fields of TTFFont

Fields of BitmapFont

Methods

impl Font
[src]

[src]

Load a new TTF font from the given file.

[src]

Loads a new TTF font from data copied out of the given buffer.

[src]

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.

[src]

Returns a baked-in default font: currently DejaVuSerif.ttf Note it does create a new Font object with every call.

[src]

Get the height of the Font in pixels.

The height of the font includes any spacing, it will be the total height a line needs.

[src]

Returns the width a line of text needs, in pixels. Does not handle line-breaks.

[src]

Breaks the given text into lines that will not exceed wrap_limit pixels in length. It accounts for newlines correctly but does not try to break words or handle hypenated words; it just breaks at whitespace. (It also doesn't preserve whitespace.)

Returns a tuple of maximum line width and a Vec of wrapped Strings.

Trait Implementations

impl Clone for Font
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Font
[src]

[src]

Formats the value using the given formatter.