Skip to content

Text rendering panics in newest version (0.115.0) #283

@kaikalii

Description

@kaikalii

With version 0.115.0, this following code panics:

use piston_window::*;

fn main() {
    let mut window: PistonWindow = WindowSettings::new("test", [800; 2]).build().unwrap();
    let mut glyphs = window.load_font("firacode.ttf").unwrap();
    while let Some(event) = window.next() {
        window.draw_2d(&event, |Context { transform, .. }, g, device| {
            clear([0.0, 0.0, 0.0, 1.0], g);
            text(
                [1.0; 4],
                80,
                "Hellow World!",
                &mut glyphs,
                transform.trans(20.0, 100.0),
                g,
            )
            .unwrap();
            glyphs.factory.encoder.flush(device);
        });
    }
}

Looking at the backtrace, the actual panic originates from rusttype. Not sure if this is a problem with piston, rusttype, or the font I am using, but this font did not cause problems in previous versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions