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?
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
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 );