Coder Social home page Coder Social logo

Problem when using maxfontsize about bigtext HOT 5 OPEN

zachleat avatar zachleat commented on June 26, 2024
Problem when using maxfontsize

from bigtext.

Comments (5)

skmbr avatar skmbr commented on June 26, 2024

Interestingly if I comment out the following 4 lines it seems to work fine:

          if(newFontSize + j*intervals[m] > maxFontSize) {
            newFontSize = maxFontSize;
            break outer;
          }

Can anyone tell me what problems removing that code is likely to cause?

from bigtext.

zachleat avatar zachleat commented on June 26, 2024

Can you try again with 0.1.8? I changed some of the resize logic.

from bigtext.

alexrumsey avatar alexrumsey commented on June 26, 2024

I'm using 0.1.8 and I am having the same issue. Commenting out the same 4 lines that skmbr mentioned above fixed the issue for me.

from bigtext.

pasqualevitiello avatar pasqualevitiello commented on June 26, 2024

Confirm, commenting those lines fixed the issue.

from bigtext.

mthurman avatar mthurman commented on June 26, 2024

I can confirm. I added some logging by moving this console.log up a line so it's always run: https://github.com/zachleat/BigText/blob/master/src/bigtext.js#L139. And adding logging form and j in the 2 loops. Here's a broken run (using maxFontSize: 98 and keeping those lines uncommented). My maxwidth is 560.

409 " previous: 0" "font-size at 8" "prior: 59" "new:67"
m 0 j 2
457 " previous: 409" "font-size at 8" "prior: 67" "new:75"
m 0 j 3
506 " previous: 457" "font-size at 8" "prior: 75" "new:83"
m 0 j 4
555 " previous: 506" "font-size at 8" "prior: 83" "new:91"
m 0 j 5
599 " previous: 0" "word-spacing at 1" "prior: 0" "new:1"

Here's another run commenting those lines out but keeping maxFontSize: 98

m 0 j 1
409 " previous: 0" "font-size at 8" "prior: 59" "new:67"
m 0 j 2
457 " previous: 409" "font-size at 8" "prior: 67" "new:75"
m 0 j 3
506 " previous: 457" "font-size at 8" "prior: 75" "new:83"
m 0 j 4
555 " previous: 506" "font-size at 8" "prior: 83" "new:91"
m 0 j 5
604 " previous: 555" "font-size at 8" "prior: 91" "new:99"
m 1 j 1
579 " previous: 0" "font-size at 4" "prior: 91" "new:95"
m 2 j 1
561 " previous: 0" "font-size at 1" "prior: 91" "new:92"
m 3 j 1
555 " previous: 0" "font-size at 0.1" "prior: 91" "new:91.1"
m 3 j 2
556 " previous: 555" "font-size at 0.1" "prior: 91.10000000000001" "new:91.2"
m 3 j 3
557 " previous: 556" "font-size at 0.1" "prior: 91.2" "new:91.3"
m 3 j 4
557 " previous: 557" "font-size at 0.1" "prior: 91.30000000000001" "new:91.4"
m 3 j 5
558 " previous: 557" "font-size at 0.1" "prior: 91.4" "new:91.5"
m 3 j 6
559 " previous: 558" "font-size at 0.1" "prior: 91.5" "new:91.6"
m 3 j 7
559 " previous: 559" "font-size at 0.1" "prior: 91.60000000000001" "new:91.7"
m 3 j 8
560 " previous: 559" "font-size at 0.1" "prior: 91.7" "new:91.8"
560 " previous: 0" "word-spacing at 1" "prior: 0" "new:1"

Notice in the working case it tries 99, and then resizes back down. My maxwidth is 560px.

from bigtext.

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.