Text Layer Manipulation
-
RagnaroktA
Text Layer Manipulation
So what I'm looking to do is resize the text in a layer to fit into the text box for that layer, but I don't want the text to be larger than 72 pt. I'm really not sure where to begin. Anyone have any snippets or ideas?
-
Mike Hale
Text Layer Manipulation
There are several ways you can fit text and the text kind can effect the results.
You start with getting the bounds of the text layer and comparing the width of the bounds to the size you want.
From there you can either transform/scale the text layer so that it fits. That would be the fastest way and get the best fit but it would be hard to determine the point size of the transformed text in some versions of Photoshop. So you may not be able to check the upper limit.
Another way would be to change the size of the text and get the new bounds in a loop, breaking out of the loop when the text fits or the upper limit is reached.
With paragraph text you have to deal with over-set text in not included in the bounds and there isn't a good way to check for over-set text in a script.
If you tell me what kind of text your are using and the size you want to fix the text layer to, I can post a sample snippet.
You start with getting the bounds of the text layer and comparing the width of the bounds to the size you want.
From there you can either transform/scale the text layer so that it fits. That would be the fastest way and get the best fit but it would be hard to determine the point size of the transformed text in some versions of Photoshop. So you may not be able to check the upper limit.
Another way would be to change the size of the text and get the new bounds in a loop, breaking out of the loop when the text fits or the upper limit is reached.
With paragraph text you have to deal with over-set text in not included in the bounds and there isn't a good way to check for over-set text in a script.
If you tell me what kind of text your are using and the size you want to fix the text layer to, I can post a sample snippet.
-
RagnaroktA
Text Layer Manipulation
I can do you one better. I PMed you a link to the .psd file I'm using. I'd like all of the text layers except the numbers field to resize the text when I batch process them. Is that possible?
-
Mike Hale
Text Layer Manipulation
I would first change the text type of the answer layers to pointText. I don't think they need to be paragraphText as they are single lines.
With the question and info text layers the size of the paragraphText bounding box is larger than I would think you want the text to be so I am not sure what size you want those layers.
With the question and info text layers the size of the paragraphText bounding box is larger than I would think you want the text to be so I am not sure what size you want those layers.
-
RagnaroktA
Text Layer Manipulation
That can be arranged for sure. My thinking was I may want to make certain super long answers two lines, but I'm really more worried about the question and info text being sized correctly. The way I set it up, the text box is the maximum size it can be (because I need it to fit within the gray box for said text). Really, I want the script to go through and resize (by scaling the text down) whatever text to fit within that text box (with a maximum font size of 72) so that I don't have to go through and manually correct each slide if there's a bunch of text in the data set. Would it help if I put together example slides of how I want it to end up vs how it is when it's batched right now?
-
RagnaroktA
Text Layer Manipulation
Mike,
Have you got any ideas for what I need to do to make that happen?
Have you got any ideas for what I need to do to make that happen?
-
RagnaroktA
Text Layer Manipulation
Mike,
Any thoughts on how to make this happen? I still haven't got it working, and I'd love some insight.
Any thoughts on how to make this happen? I still haven't got it working, and I'd love some insight.