davatron5000 / FitText.js

A jQuery plugin for inflating web type
http://fittextjs.com
6.76k stars 1.39k forks source link

Calculate compressor ratio automatically #90

Open petewarman opened 10 years ago

petewarman commented 10 years ago

I've added in a few lines in order to calculate correct compressor ratio on the fly rather than having to manually configure the plugin for each typeface.

Probably also worth pointing out that removing the compressor attribute changes the API.

davatron5000 commented 10 years ago

So whitespace nowrap, what if you wanted text to wrap to 2 lines but also wanted to maintain scalability?

petewarman commented 10 years ago

Ah ok. That's a different use case to how I imagined this was used.

The nowrap is just left in to get around the occasional rounding error in webkit. Shouldn't be too hard to find another way around that.

Would also need to add in a multiline parameter to configure how many lines to break over.

petewarman commented 10 years ago

So thinking about it - text wrapping doesn't provide equal length lines so multi line support is always going to require some manual tweaking. I've added in a scale factor which is used to determine what percentage of the width the text should occupy.