Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panicked at 'assertion failed: !result.is_null()' #7

Closed
jdm204 opened this issue Jul 17, 2019 · 5 comments · Fixed by #10
Closed

panicked at 'assertion failed: !result.is_null()' #7

jdm204 opened this issue Jul 17, 2019 · 5 comments · Fixed by #10
Labels
bug Something isn't working

Comments

@jdm204
Copy link

jdm204 commented Jul 17, 2019

Hi, getting a panic irrespective of the input file I try. Only tested so far on macOS with cargo --version 1.35.0 (6f3e9c367 2019-04-04).

`
-> file test.rs
test.rs: c program text, ASCII text

-> export RUST_BACKTRACE=1 && silicon test.rs -o test.png
thread 'main' panicked at 'assertion failed: !result.is_null()', /Users/jamie/.cargo/registry/src/github.com-1ecc6299db9ec823/core-graphics-0.17.3/src/context.rs:104:13
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::panicking::default_hook::{{closure}}
2: std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic
4: font_kit::loaders::core_text::Font::rasterize_glyph
5: silicon::font::FontCollection::draw_text_mut
6: silicon::formatter::ImageFormatter::format
7: silicon::main
8: std::rt::lang_start::{{closure}}
9: main
`

@joequincy
Copy link

I have a nearly identical error (note that mine is missing line 6 from above)

~/>RUST_BACKTRACE=1 silicon --from-clipboard -l Ruby -o test.png
thread 'main' panicked at 'assertion failed: !result.is_null()', /Users/accountname/.cargo/registry/src/github.com-1ecc6299db9ec823/core-graphics-0.17.3/src/context.rs:104:13
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::begin_panic
   4: font_kit::loaders::core_text::Font::rasterize_glyph
   5: silicon::font::FontCollection::draw_text_mut
   6: silicon::main
   7: std::rt::lang_start::{{closure}}
   8: main

Also tested using a filename instead of the --from-clipboard flag, and using Rust, Javascript, and PHP sources. All produce the same error and trace as above.

On OSX, using:
rust version 1.36.0 (a53f9df32 2019-07-03)
cargo 1.36.0 (c4fcfb725 2019-05-15)

@Aloxaf
Copy link
Owner

Aloxaf commented Jul 18, 2019

@NextTimeJim @joequincy Thank you for reporting it.

It seems like a bug of font-kit.

I don't have a macOS computer. Could you please test font-kit using cargo run --example render-glyph -- 'Monaco' A 32 to see whether it will print an 'A' on your terminal?

@Aloxaf Aloxaf added the bug Something isn't working label Jul 19, 2019
@joequincy
Copy link

joequincy commented Jul 19, 2019

I'm happy to explore this, but I'm not familiar with Rust development.
I navigated to where the font-kit crate is stored, at

/Users/accountname/.cargo/registry/src/github.com-1ecc6299db9ec823/font-kit-0.3.1

from there I ran cargo run --example render-glyph -- 'Monoid' A 32 and it rendered fine.

Running with 'Monaco', there are problems

If I ran cargo run --example render-glyph -- 'Monaco' A 32, the output was:

warning: type could implement `Copy`; consider adding `impl Copy`
  --> src/sources/core_text.rs:38:1
   |
38 | pub struct CoreTextSource;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: lint level defined here
  --> src/lib.rs:123:9
   |
123| #![warn(missing_copy_implementations)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    Finished dev [unoptimized + debuginfo] target(s) in 44.11s
     Running `target/debug/examples/render-glyph Monaco A 32`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Parse', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

The Monaco font is installed on my system, so I'm not sure why this is the case.

Following on from this, I tried to specify the font when running silicon using the -f flag, but I received the same error backtrace as my prior comment.

@Aloxaf
Copy link
Owner

Aloxaf commented Jul 20, 2019

@joequincy Thank you
I tested it in the macOS virtual machine and finally found the reason.
It's caused by the whitespace (https://github.com/pcwalton/font-kit/issues/7)

@Aloxaf Aloxaf mentioned this issue Jul 20, 2019
@Aloxaf
Copy link
Owner

Aloxaf commented Jul 20, 2019

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants