Skip to main content
Known Participant
June 19, 2012
Question

Is it possible to get these datas?

  • June 19, 2012
  • 2 replies
  • 590 views

hi, guys,

I encountered a problem about the leading amount.Does anybody help me to explain the problem?

Please see the image below, i want to get these two amount? Is it possible?

Thanks very much!

This topic has been closed for replies.

2 replies

Inspiring
June 20, 2012

I don't know it this will give you the info you need and match what PHP expects but the following will give you the leading of the text in a pargarph textItem and will give you the font size of the second text range( the second line in your example ). Assumes ruler is set to pixels.

var leading = app.activeDocument.activeLayer.textItem.leading;

var ref = new ActionReference();

ref.putEnumerated( stringIDToTypeID( "layer" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));

var desc= executeActionGet( ref );

var list =  desc.getObjectValue(charIDToTypeID("Txt "));

var textStyleRange =  list.getList(charIDToTypeID("Txtt"));

var textStyleRange1 = textStyleRange.getObjectValue(1);

var textStyle1 = textStyleRange1.getObjectValue(charIDToTypeID('TxtS'));

var secondLineSize = textStyle1.getUnitDoubleValue(charIDToTypeID('Sz  '));

alert( leading.value+' : '+ secondLineSize );

c.pfaffenbichler
Community Expert
Community Expert
June 19, 2012

I wouldn’t know how.

As far as I can tell the height of the field signifying text selection is not identical to the type size, therefore the leading can’t be used to calculate the distance between upper and lower field. (And this would be assuming all letters are the same size etc.)

What is the ultimate goal of this task anyway?

Known Participant
June 19, 2012

I want to get all the text layer properties,  and use these data to generate a new image use PHP script.

But now when generate the image, the leading is different between PHP and PSD . So the image generated by PHP is different with the orignal PSD