Giter VIP home page Giter VIP logo

Comments (3)

timdream avatar timdream commented on July 26, 2024

Sorry for the late reply. This is probably a bug in the browser (not being able to draw a word with the size of 11445!). I did see an error in the JS console in Firefox (NS_ERROR_FAILURE:) but it's not actionable since it does not contain any line or backtrace information.

Maybe we could find the real method that throws and wrap it with try {} catch {}?

from wordcloud2.js.

danielquinn avatar danielquinn commented on July 26, 2024

Hmm. I think that I was under the impression that the number wasn't the font-size but rather the "weight" of the word and that the Javascript would determine the font-size based on that. What you're saying makes sense though, so maybe something as simple as a check on each value to see if it exceeds 500 (or something else reasonable) would be appropriate?

For what it's worth though, I don't think it's the browser that's unable to render text at that size, but rather that the string requested can't fit on the canvas requested at that size. I base this assertion on the fact that I just used Firefox's dev tools to change the font on this page to 20000pt and while everything was HUGE, it didn't explode.

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

Yes, the number is the weight but unless your weight factor is way smaller than 1 I assume 11445 means font-size > 11445px?

DOM rendering is quiet different than 2d canvas rendering, so the former works doesn't means the latter always works, unfortunately. You can refer to #14 and read the previous experiences. However, since the browser did not crash like it did in #14, we should be able to safely "workaround" it with a try ... catch block.

(It is also entirely possible my script did not pass the right parameters to the native code, so it throws at me)

All in all we need to find which call throws first.

from wordcloud2.js.

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.