Coder Social home page Coder Social logo

Add support for emojis about silicon HOT 2 OPEN

orhun avatar orhun commented on May 27, 2024 3
Add support for emojis

from silicon.

Comments (2)

lost22git avatar lost22git commented on May 27, 2024

same

warning] No font found for character `🤣`
[warning] No font found for character `👻`
[warning] No font found for character `🦉`
`warning] No font found for character `
[warning] No font found for character `🤣`
[warning] No font found for character `👻`
[warning] No font found for character `🦉`
`warning] No font found for character `

from silicon.

chris-av avatar chris-av commented on May 27, 2024

So here is what I tried.

silicon --font "Apple Color Emoji" inputfile.sh -o output.png

No error is shown, unless I run Rust in debug mode with RUST_BACKTRACE. Then I get this:

screenshot-20240403--00_31_58_AM

The panic is being thrown when calling Self:get_glyph_width(). I think this is the offending line:

    fn get_glyph_width(font: &Font, id: u32, size: f32) -> u32 {
        let metrics = font.metrics();
        let advance = font.advance(id).unwrap();
        (advance / metrics.units_per_em as f32 * size).x().ceil() as u32; // offending line here
    }

I guess with emoji, the metrics.units_per_em appears to be zero (see screenshot), but since it is coerced to a number, the end result of get_glyph_width is a large number that overflows and causes the panic.

Edit: I did verify that "Apple Color Emoji" is a font that is listed by the silicon --list-fonts output. Same result with other fallback emoji font, like "Noto Color Emoji".

from silicon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.