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

Negative font size on Mac OS X/iPad #54

Open
CodingSamurai opened this issue May 28, 2014 · 5 comments
Open

Negative font size on Mac OS X/iPad #54

CodingSamurai opened this issue May 28, 2014 · 5 comments

Comments

@CodingSamurai
Copy link

For some reason this plugin was generating a negative font size for a long title which was causing it to instead use the default size (which was far too large).

I couldn't figure out where the calculation was going wrong, but I was able to fix it by modifying the generateCSS function so that the for loop instead reads (line 78):

(linesFontSizes[j] > 0 ? ' font-size: ' + linesFontSizes[j] + 'px;' : ' font-size: 25px;') +

I had to hardcode the min font size because "minFontSizes" seemed to be a boolean instead of a numeric value.

@timrwood
Copy link

I ran into issues with negative sizes as well.

The starting font-size must be small enough to guarantee that each individual line is not wrapping pre-BigText. If the line is too long, BigText will not size it correctly.

After reading this line from the readme, I set the default font-size in my css to a much lower value and no longer saw negative font sizes.

@zachleat
Copy link
Owner

Thanks @timrwood, this is likely the issue. I’d like to fix this internally to BigText so I’ll leave this issue open to log it. Thanks!

@wearetelescopic
Copy link

In case it helps anyone, the offending value in the code that causes a negative font size for small displays is line 211

var autoGuessSubtraction = 32, // font size in px

this gets substracted and if the font is generally smaller, results in a negative number.

So just setting this to lets say 10 fixes it:

var autoGuessSubtraction = 10, // font size in px

@riseink
Copy link

riseink commented Feb 16, 2017

wearetelescopic's post fixed this for me

@JayAhrDe
Copy link

JayAhrDe commented Feb 22, 2019

Is there any reason for not changing this value in code? Would it break something else?

The tip by @wearetelescopic actually helps, thanks a lot!, and is still needed:
https://jsfiddle.net/70d2caze/1/

Set autoGuessSubtraction = 10 and it will look neat and tidy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants