3 Replies Latest reply on Jun 19, 2012 8:17 PM by Michael L Hale

    Is it possible to get these datas?

    michael.shen Level 1

      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!


        • 1. Re: Is it possible to get these datas?
          c.pfaffenbichler Level 9

          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?

          • 2. Re: Is it possible to get these datas?
            michael.shen Level 1

            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

            • 3. Re: Is it possible to get these datas?
              Michael L Hale Level 5

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