4 Replies Latest reply on Sep 9, 2015 1:55 AM by S Hopkins

    get text height

    aviR

      Hii all

      Can anyone please tell me how can I know the height of the text in a textframe?

      Which property is used?

      Please help

      Thanks

        • 1. Re: get text height
          Peter Kahrel Adobe Community Professional & MVP

          What do you mean by 'the height of the text in a textframe'?

          • 2. Re: get text height
            aviR Level 1

            The measurement upto where the text is present in a textframe.

            • 3. Re: get text height
              Peter Kahrel Adobe Community Professional & MVP

              myTextFrame.lines[0].baseline - myTextFrame.lines[0].ascent

               

              returns the ascent position of the first line.

              • 4. Re: get text height
                S Hopkins Adobe Community Professional

                Sounds like you want the depth of all the text in the text frame:

                 

                Assuming the text frame is selected, In AppleScript this would be:

                tell application "Adobe InDesign CC 2015"

                  set measurement unit of script preferences to points

                  set selList to selection

                  set selItem to item 1 of selList

                  set text1 to a reference to text 1 of selItem

                  set textBottom to baseline of line -1 of selItem

                  set textTop to ascent of line 1 of selItem

                  set textDepth to textBottom - textTop

                end tell

                textDepth

                 

                In ExtendScript:

                app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;

                var myTextFrame = app.selection[0];

                var textBottom = myTextFrame.lines.item(-1).baseline;

                var textTop = myTextFrame.lines.item(0).ascent;

                var textDepth = textBottom - textTop;

                textDepth;

                 

                Hope this makes it clearer for you.