Skip to main content
Participant
August 24, 2020
Question

How to resize text layer without text transformation?

  • August 24, 2020
  • 1 reply
  • 336 views

I would like to resize the text layer using resize(..) api but this deforms the text. Is there any way to transform the text bounding box without transfroming text?

 

var textLayerRef = DummyGroup.artLayers.add();
textLayerRef.kind = LayerKind.TEXT;
var textItemRef = textLayerRef.textItem;
textItemRef.contents =  "Lorem Ipsum";
textItemRef.size = new UnitValue(14, "px");
textLayerRef.resize(200, 100, AnchorPosition.TOPLEFT); // This deforms the text
This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
August 24, 2020

Why are you using resize set the font size you want. You may need to calculate what size you want to use.   I think I remember I had to save the resolution change the document resolution to 72 because Adobe fonts seem to be baste on points ie 72DPI I could them divide the document height in pixels  by the number of lines of text I want to fit over the canvas set the text layer font size.  Like( height /5) if  I wanted text to be 1/5 document height.  Them I could restore  the document resolution and the text size would be good. 

JJMack
Participant
October 13, 2020

I would like to create Paragraph Text layers using a script with a specific bounding box. The layer.bounds give me the tight bounding box instead of the values you see on the layer's properties window. I'll try to get the bounding box from transform, that should help.