1 Reply Latest reply on Aug 30, 2013 5:14 AM by DaveSofTypefi

    Placing box exactly above the found text

    Learner Learner Level 1

      Hi All,


      Can anyone help me on this, i need to place a box exactly above the found text in the story.




        • 1. Re: Placing box exactly above the found text
          DaveSofTypefi Level 2

          What if the found text is on more than one line? More than one page?


          Assuming that neither of these is an issue and assuming that there's no rotation involved and assuming all the found text is the same size and assuming that it is not overset, this is a fairly easy task.


          myLeft = myFoundText.horizontalOffset;

          myRight = myFoundText.endHorizontalOffset;

          myBase = myFoundText.baseline;

          myBottom = myBase + myFoundText.descent;

          myTop = myBase + myFoundText.ascent;

          myBounds = [myTop, myLeft, myBottom, myRight];

          myFoundText.parentTextFrames[0].parentPage.rectangles.add({geometricBounds : myBounds});


          I just composed that here and haven't tested it, but it looks right. You might prefer to use fontSize or Leading to determine the height of the rectangle, but don't forget that text extends below its baseline.