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

How to obtain the horizontal flip, vertical flip, line spacing, and letter spacing of the text layer

Participant ,
May 10, 2024 May 10, 2024

How to obtain the horizontal flip, vertical flip, line spacing, and letter spacing of the text layer in the psd file through script or .net

li27112570w0z3_0-1715407908891.png

 

TOPICS
Actions and scripting
1.1K
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
Participant ,
May 11, 2024 May 11, 2024

What I want to get most is the flipped state。The red rectangle shows the flipped text. How to get the flipped status?

li27112570w0z3_0-1715412126775.png

 

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
Community Expert ,
May 12, 2024 May 12, 2024

Please provide the sample file. 

 

And are you sure it’s flipped and not rotated 180˚?

With »A« it’s hard to tell. 

Edit: Sorry, I hadn’t perused the screenshot fully. 

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
People's Champ ,
May 12, 2024 May 12, 2024

I don't think there are any flip statuses.

They're just buttons.

A horizontal flip simply reverses the sign of xx and yx,

and a vertical flip reverses the sign of xy and yy.

 

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
Participant ,
May 12, 2024 May 12, 2024

Can the flip state be calculated from the values of xy and yy? Or there are other ways

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
Community Expert ,
May 12, 2024 May 12, 2024

Please provide the sample file. 

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
People's Champ ,
May 13, 2024 May 13, 2024
quote

Can the flip state be calculated from the values of xy and yy? Or there are other ways


By @javaer

 

You can try it this way

 

 

var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("textKey"));
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var tkey = executeActionGet(r).getObjectValue(stringIDToTypeID("textKey"));

var xx = 1;
var xy = 0;
var yx = 0;
var yy = 1;
var tx = 0;
var ty = 0;
          
if (tkey.hasKey(stringIDToTypeID("transform")))
    {
    xx = tkey.getObjectValue(stringIDToTypeID("transform")).getDouble(stringIDToTypeID("xx"));
    xy = tkey.getObjectValue(stringIDToTypeID("transform")).getDouble(stringIDToTypeID("xy"));
    yx = tkey.getObjectValue(stringIDToTypeID("transform")).getDouble(stringIDToTypeID("yx"));
    yy = tkey.getObjectValue(stringIDToTypeID("transform")).getDouble(stringIDToTypeID("yy"));
    tx = tkey.getObjectValue(stringIDToTypeID("transform")).getDouble(stringIDToTypeID("tx")); 
    ty = tkey.getObjectValue(stringIDToTypeID("transform")).getDouble(stringIDToTypeID("ty")); 
    }    

var W = xx/Math.cos(Math.atan2(xy,xx))*100;

var H = (xx*yy-xy*yx)/(xx/Math.cos(Math.atan2(xy,xx)))*100;

var A = Math.atan2(xy,xx)*180.0/Math.PI;

var S = (Math.atan2(yx,yy)+Math.atan2(xy,xx))*180.0/Math.PI;

if (S < 0)   S += 360;
if (S > 180) S -= 180;
if (S > 90)  S -= 180;

var fliped_H = xx<0;
var fliped_V = yy<0;

if (fliped_H && fliped_V) fliped_H = fliped_V = false; 


alert("Matrix:\n"+
xx.toFixed(2) + "  " + yx.toFixed(2) + "\n" + xy.toFixed(2) + "  " + yy.toFixed(2) + "\n\n" +
"W = " + W.toFixed(1) + "\nH = " + H.toFixed(1) + "\n\nA = " + A.toFixed(2) + "\nS = " + S.toFixed(1) + "\n\n" +
"fliped_H = "+fliped_H + "\nfliped_V = "+fliped_V);

 

 

rbin_0-1715628034877.png

 

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
New Here ,
May 12, 2024 May 12, 2024

To achieve these effects in Adobe Photoshop:

  1. Horizontal Flip: Select the text layer, then go to Edit > Transform > Flip Horizontal.

  2. Vertical Flip: Similarly, select the text layer, then go to Edit > Transform > Flip Vertical.

  3. Line Spacing: To adjust line spacing, go to Window > Character to open the Character panel. Adjust the "Leading" option, which controls the spacing between lines of text.

  4. Letter Spacing: With the text layer selected, go to Window > Character to open the Character panel. Adjust the "Tracking" option, which controls the spacing between individual letters.

These options allow you to manipulate text layers in various ways to achieve the desired effects.

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
Participant ,
May 12, 2024 May 12, 2024

I hope to get these status values through script instead of operating on the interface.

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
Community Expert ,
May 13, 2024 May 13, 2024

 

// based on code by michael l hale;
// 2020, use it at your own risk;
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID("property"), stringIDToTypeID('textKey'));
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
try {var theTransform = textDesc.getObjectValue(stringIDToTypeID("transform"));
checkDesc2 (theTransform, true);
} catch (e) {};
};

Screenshot 2024-05-13 at 17.19.06.pngScreenshot 2024-05-13 at 17.19.29.pngScreenshot 2024-05-13 at 17.19.46.png

 

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
Participant ,
May 13, 2024 May 13, 2024
LATEST

Sincerely thank you all for your replies and help

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