4 Replies Latest reply on Jun 23, 2009 7:35 AM by f_lopes

    [CS4] - How to move and rotate an Outline?




      I'm trying to write a script to input some text, transform it into outline and then position it and rotate it.


      I have created the outline with the following code and it's working fine:


      myOutline = myText.createOutlines(true);

      But now I'm having some problems with position and rotation. I tryied to move it with this code ( arrPosOutline is an Array for x and y position ):


       var arrPosOutline1 = new Array();
           arrPosOutline1[0] = "10p";
           arrPosOutline1[1] = "20p";

      I got a sintax error, but I didn't find another sintax for that.


      I also tryied to rotate it with this:

      myOutline.absoluteRotationAngle = 45;


      I also tryied this:

      myOutline.rotationAngle = 45;


      Both codes didn't work and returned no error.


      Someone could give me some direction?



      Thanks a lot

        • 1. Re: [CS4] - How to move and rotate an Outline?
          AdobeScripts Level 3
           var arrPosOutline1 = new Array();
               arrPosOutline1[0] = "10p";
               arrPosOutline1[1] = "20p";


          maybe because your variable is arrPosOutline1


          by definition of CreateOutlines:


          Converts text to outlines. Each line of text becomes a polygon object. When the converted text is a single letter that has no internal spaces or detached parts, the polygon contains only a single path. Note: To determine whether a font allows the creation of outlines, see allow outlines.
              Return value: The polygon or polygons.
              DeleteOriginal: If true, deletes the original text. If false, creates the outlines as separate object(s) on top of the text.


          maybe your text is longer than ONE line - so your Outlined object ISN'T single object - maybe it is array/group/collection of outlined lines of text ?

          so it doesn't have "rotation angles" ...





          1 person found this helpful
          • 2. Re: [CS4] - How to move and rotate an Outline?
            f_lopes Level 1

            Hi Robert,


            Thanks for the help.


            The wrong name on the array is due to a bad copy and paste... Sorry...


            I read that description on the Object Model Viewer, but  in InDesign when I select the Outline it selects all the outlines at once, because of that I thought that should be possible to rotate it with one function only.


            I tried to move and rotate the textframe before transforming it into Outlines, but for doing that I should have to redimention the boundaries to fit the new text, but I didn't find a function for that. I just find the geometricBounds function, but if I don't know the exact space of the new text to tell the geometricBounds how big the textframe should be.


            Is there a way to make the textframe it to it's content?


            Because by doing that I think I should be able to position and rotate the textframe and then make it an outline. Or am I wrong?



            Thanks a lot

            • 3. Re: [CS4] - How to move and rotate an Outline?
              AdobeScripts Level 3

              you can fit TextFrame to content by using:


              Sub Fit(Given As idFitOptions)
                  Member of InDesign.TextFrame
                  Applies the specified fit option to content in a frame. / Given: The fit option to use.

              Const idFrameToContent = 1718906723 (&H66746F63)
                  Member of InDesign.idFitOptions
                  Resizes the frame so it fits the content.


              (this is from VB - I think, in JS it will be frameToContent or use numeric value)


              but there is one condition - at least one word (or one-letter-word) need to be visible in TextFrame - if not - nothing happen

              if you will have visible more than one line of text in TextFrame - InDesign will preserve the width of TextFrame and change only height





              • 4. Re: [CS4] - How to move and rotate an Outline?
                f_lopes Level 1

                Hi Robert,


                Thanks for the help. Yesterday I found a solution for my problem.


                I used two functions to fit the frame to the content of the textframe. I used two because InDesign doesn't fit the frame horizontally ( I don't know why ).


                These are the functions I'm using:


                 // fit vertical


                And this one, by a forum member ( wich I don't remember the name, sorry ):


                 // fit horizontal
                 var gbs = myLeftTextFrame.geometricBounds; 
                 var maxR = getMax(myLeftTextFrame.insertionPoints.everyItem().horizontalOffset); 
                 gbs[3] = maxR; 
                 myLeftTextFrame.geometricBounds = gbs; 
                 function getMax(anArray) { 
                 return anArray.sort(revNumerical)[0]; 
                 function revNumerical(a,b) { return b-a } 


                Now I'll only position the text ( with the move(); function ) and rotate it ( with the absoluteRotationAngle property ).


                And just after that I'll create an Outline of the text. I have to do that because I'll generate a PDF and Acrobat Reader creates a hyperlink on every e-mail adress.



                Thanks again for the help.