davatron5000 / FitText.js

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

Added Math.round to font sizing to avoid non-integer pixel values #33

Closed ghepting closed 10 years ago

ghepting commented 12 years ago

Simple addition, but it seems to have reduced the effect of font character artifacts and improved native OS's ability to apply anti-aliasing, especially with fonts loaded via @font-face

davatron5000 commented 12 years ago

Are non-integer pixel values a problem? Wouldn't this just be resolved (faster) by the browser?

ghepting commented 12 years ago

It could have just been the fonts I was working with in this case, but extreme aliasing was resulting due to decimal values. Once I added rounding in it was much crisper. On Jul 2, 2012 10:14 AM, "Dave Rupert" < reply@reply.github.com> wrote:

Are non-integer pixel values a problem? Wouldn't this just be resolved (faster) by the browser?


Reply to this email directly or view it on GitHub: https://github.com/davatron5000/FitText.js/pull/33#issuecomment-6714087

bencevans commented 11 years ago

I'd suggest using Math.floor rather than Math.round so that it's never rounded up making the text that one pixel greater than it's bounds pulling just one word to a new line :smile:

davatron5000 commented 10 years ago

I may consider this more in the future, but things seem to be heading the way of the subpixel. Also, there's a merge conflict in the commit, so I'm going to close this.