nannou-org / nannou

A Creative Coding Framework for Rust.
https://nannou.cc/
6.05k stars 307 forks source link

Strange behaviour using fonts #891

Open macbryla opened 2 years ago

macbryla commented 2 years ago

This might be just my lack of understanding of the limitation here, but since I am not getting any errors, I assume it's an issue.

I am using the draw_capture_hi_res.rs as my example. I am working on a project that uses a lot of text, on a very large canvas 8192x8912 to be used as a print.

  1. Firstly why is there a limit of 8192? Is that related to my machine? M1 MacBook Pro 16GB

  2. When I run the code below, the fonts are gibberish. But when I change the font size of the two bottom texts to 300, it all works as expected. Why does a large font cause issues for all text.

  3. Is there a plan to export to SVG?

Appreciate your help if there is a fix. Thanks.

// adjusted size in model(...) let texture_size = [8192, 8192];

// added code to update(...) `let t = "This is a test text";

for i in (-3900..4100).step_by(250) {
    for j in (-3000..4000).step_by(45) {
        draw.text(t)
            .font_size(30)
            .color(WHITE)
            .no_line_wrap()
            .x_y(i as f32, j as f32);
    }
}

draw.text("This is a BIG TEXT TEST 1")
    .font_size(350)
    .color(WHITE)
    .no_line_wrap()
    .x_y(0.0, -3300.0);

draw.text("This is a BIG TEXT TEST 2")
    .font_size(350)
    .color(WHITE)
    .no_line_wrap()
    .x_y(0.0, -3800.0);`