Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Transforming the width and/or height of text layer?

Explorer ,
Aug 25, 2024 Aug 25, 2024

In Extendscript, how do I change the width and height of a text layer separately? I know about changing the font size but that is more generalized, I want specific changes in the width and/or height.

 

TheAzzam_0-1724584720702.png

 

 

I used Scriptlistener to get some code. When the original width is 14.5 inches and height is 6 inches, then increasing one of width or height by 0.1 inches performs a horizontal or vertical offset of 3.6000 (which I assume is pixels):

var idTrnf = charIDToTypeID( "Trnf" );
var desc231 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref1.putEnumerated( idLyr, idOrdn, idTrgt );
desc231.putReference( idnull, ref1 );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc231.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc232 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idRlt = charIDToTypeID( "#Rlt" );
desc232.putUnitDouble( idHrzn, idRlt, 3.600000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idRlt = charIDToTypeID( "#Rlt" );
desc232.putUnitDouble( idVrtc, idRlt, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc231.putObject( idOfst, idOfst, desc232 );
var idWdth = charIDToTypeID( "Wdth" );
var idPrc = charIDToTypeID( "#Prc" );
desc231.putUnitDouble( idWdth, idPrc, 100.689655 );
var idIntr = charIDToTypeID( "Intr" );
var idIntp = charIDToTypeID( "Intp" );
var idBcbc = charIDToTypeID( "Bcbc" );
desc231.putEnumerated( idIntr, idIntp, idBcbc );
executeAction( idTrnf, desc231, DialogModes.NO );

I do not know how this 3.6000 is being calculated. Maybe if I find out about the logic behind this, then I can write some code

TOPICS
Actions and scripting , Windows
316
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Aug 26, 2024 Aug 26, 2024

What is the image’s resolution (Image > Image Size)? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 26, 2024 Aug 26, 2024
LATEST

Do you want to change the layer bounds or the TextItem size?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines