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

pub enum Font {
    TTFFont {
        font: Font<'static>,
        points: u32,
        scale: Scale,

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).


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

A TrueType font stored in GraphicsContext::glyph_brush


impl Font

Load a new TTF font from the given file.

Load a new TTF font from the given file, returning a font that draws lines that are the given number of pixels high.

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

Loads a new TTF font from data copied out of the given buffer, taking font size in pixels

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()

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.

Loads a new TrueType font from given file and into GraphicsContext::glyph_brush.

Retrieves a loaded font from GraphicsContext::glyph_brush.

Returns baked-in default font (currently DejaVuSerif.ttf). Note it does create a new Font object with every call; although the actual data should be shared.

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.

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Font

Formats the value using the given formatter. Read more

impl Into<FontId> for Font

Performs the conversion.

Auto Trait Implementations

impl Send for Font

impl Sync for Font