-
Automatic font size on text based on its width
Hello,
I’m trying to make text that decrease its font size depending on its length if its bigger than certain value. I’m trying to use while statement but with no success.The idea is lets say we have a text with font size 75 and when you are typing text and the text width reach lets say 500 we want font size to start going down.
tWidth = thisLayer.sourceRectAtTime().width;
fSize = 75;while(tWidth > 500){
fSize--;
thisLayer.text.sourceText.style.setFontSize(fSize);
tWidth = thisLayer.sourceRectAtTime().width;
};text.sourceText;