PistonDevelopers / piston

A modular game engine written in Rust
https://www.piston.rs
MIT License
4.62k stars 234 forks source link

New line bytes appear as boxes. #1339

Closed hellbound22 closed 4 years ago

hellbound22 commented 4 years ago

Code snip:

let mut char_cache = window.load_font("/usr/share/fonts/liberation/LiberationMono-Reg    ular.ttf").unwrap();
/***** *****/
text::Text::new_color([1.0, 1.0, 1.0, 1.0], font_size).draw(
    &format!("Quantidade \n/U+000Ade estrelas na câmera: {}",
        cam_map.len(),
    ),
    &mut char_cache,
    &context.draw_state,
    transform, graphics
).unwrap();

Result: image

Am I doing something wrong here?

bvssvni commented 4 years ago

I believe that newline characters are placeholder symbols. The font engine can't know where the beginning of a line is, so instead of doing this directly, it is the job of the application logic to handle this.

bvssvni commented 4 years ago

Closing.