BigText icon indicating copy to clipboard operation
BigText copied to clipboard

Negative font size on Mac OS X/iPad

Open CodingSamurai opened this issue 11 years ago • 5 comments

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.

CodingSamurai avatar May 28 '14 06:05 CodingSamurai

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.

timrwood avatar Aug 14 '14 23:08 timrwood

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!

zachleat avatar Feb 28 '15 06:02 zachleat

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

wearetelescopic avatar Apr 18 '15 19:04 wearetelescopic

wearetelescopic's post fixed this for me

riseink avatar Feb 16 '17 16:02 riseink

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.

JayAhrDe avatar Feb 22 '19 09:02 JayAhrDe