davatron5000 / FitText.js

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

How to get the same font-size on different size of containers? #68

Closed hjujah closed 11 years ago

hjujah commented 11 years ago

If i call fittext on a container whose dimensions are 1000px x 500px with the fittext value of 2 i get 25px font size. From the other hand if I enable fittext on a container whose dimensions are 500px x 500px width the fittext value of 1, I would expect to get the same value for the font-size (25px), but I don't , I get 23px! So what is the logic in this? How to keep the same font size for different size of containers?

NOTE: These values are all made up, but generaly that's what is happening...

davatron5000 commented 11 years ago

I can't debug anything until you can supply a reduced test case in a CodePen or something.

Larceniii commented 11 years ago

Most likely has to do with how many narrow and wide characters there are in the sentence/word you are using and font.

Exmple: string "www" vs "iiiiiiiiiiiiiiiiiiiiiiiiiiiiii" will need different font sizes to fit the same width.

hjujah commented 11 years ago

I think its because of the padding and border-box property, I can't deal with that atm, but will let you know in few days :) Thanks for the quick reply!

davatron5000 commented 11 years ago

This sounds like a styling issue, not really an issue with the plugin. That would be be left to Stack Overflow.

hjujah commented 11 years ago

The thing is that I have containers of 50% and of 25% width of the page. But with a constant padding of 20px and the box-sizing property seted to border-box . So the inner container where the text is located is not always twice bigger/smaller then the other one. Hope you understand my issue, but no worries, you can close the thread and I will tweak my css ;) Great plugin btw! Big up!