Closed RobinBertilsson closed 1 year ago
@RobinBertilsson I realize you posted this quite awhile ago. But could you post a CodePen or something that demonstrates the problem? Or are you just saying it'd be good to never set the font-size
to 0
ever?
Hey sorry, missed that you replied, cant rly figure out what caused it atm. But i'd say skip font-size: 0, why would you "fittext" a text with fontsize 0 :)
I'm currently having a similar issue where its calculating 0 for font-size because its currently within a hidden div in my view. Haven't found a way around it but just wanted to share one case the same event occurs.
Sometimes you'll get "font-size: 0px", this is my solution..
var value = Math.max(Math.min($this.width() / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize));
if (value !== 0) { $this.css('font-size', value); }
Works fine for me. /R