-
1. Re: Resize font to fill text box
Apod42 Feb 23, 2014 8:19 AM (in response to Apod42)After hours of digging through forums, I have found this thread: http://ps-scripts.com/bb/viewtopic.php?t=2422
I think the script there could be an answer to my problem, I need to fit the text vertically, not horizontally, so I replaced maxWidth with maxHeight. It kinda works, it does something, but not what I need
Based on the script below, how could I enlarge my text to fit a text box with a height of 1000 px?
I need something similar to the result obtained when selecting all text in a tex layer and pressing " Ctrl + Shift + > "
var maxWidth = 120;
var nameLayer = activeDocument.artLayers.getByName ("text");
var fontSize = 20;
nameLayer.textItem.size = new UnitValue (fontSize, "px");
while ((fontSize > 1) && (parseInt(nameLayer.bounds[2] - nameLayer.bounds[0]) >= maxWidth))
{
fontSize -= 1;
nameLayer.textItem.size = new UnitValue (fontSize, "px");
}
-
2. Re: Resize font to fill text box
c.pfaffenbichler Feb 26, 2014 6:20 AM (in response to Apod42)At a quick glance that code should not do what you intend in that it would make all the text content the same font size.
Scripting Type Layers that contain text with any variability (different fonts, sizes, leading, …) is not very convenient in my opinion.
-
3. Re: Resize font to fill text box
Apod42 Feb 26, 2014 7:30 AM (in response to c.pfaffenbichler)Thanks for the feedback! For the moment I will continue to do this manually, maybe in the future will find a scripting solution or plugin...


