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

pub enum Font {
    TTFFont {
        font: Font<'static>,
        points: u32,
        scale: Scale,
    },
    BitmapFontVariant(BitmapFont),
}

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

A truetype font

Fields of TTFFont

The actual font data

The size of the font

Scale information for the font

A bitmap font where letter widths are infered

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]

Creates a bitmap font from a long image of its alphabet, specified by path. The width of each individual chars is assumed to be to be image(path).width/glyphs.chars().count()

[src]

Creates a bitmap font from a long image of its alphabet. Each letter must be separated from the last by a fully transparent column of pixels. The width of each letter is infered from these letter boundaries.

[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 when drawn with the given font. It accounts for newlines correctly but does not try to break words or handle hyphenated 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. Read more

Auto Trait Implementations

impl Send for Font

impl Sync for Font