Skip to content

Crash when attempting to load font in the web + wasm_bindgen context #636

@Niedzwiedzw

Description

@Niedzwiedzw

Describe the bug
It crashes

To Reproduce

#[wasm_bindgen(start)]
pub fn main_js() -> Result<(), JsValue> {
    #[cfg(debug_assertions)]
    console_error_panic_hook::set_once();

    async fn app(window: Window, mut gfx: Graphics, mut input: Input) -> QsResult<()> {
        console_log!("trying to load font");
        let ttf = VectorFont::load("font.ttf").await?;
        console_log!("font loaded");  // <--- it never reaches this point
        // ...
    }
    run(
        Settings {
            title: "Square Example",
            size: render_size,
            ..Settings::default()
        },
        app,
    );
    Ok(())

When going to host:80/font.ttf it is present there. In the network tab I can see it being loaded
image
image

Environment and versions (please complete the following information):
manjaro linux 20.3
tested on firefox and chrome
quicksilver = "0.4.0-alpha0.5" + web-sys

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSome API breaks the contract it establishessubsystem-util

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions