2 Replies Latest reply on May 24, 2012 8:02 AM by absqua

    textFrame.fit() in CS6

    absqua Level 4

      So, I had a minute and wanted to test the new auto-fitting text frames against the usual textFrame.fit(FitOptions.FRAME_TO_CONTENT) from a performance standpoint.


      The auto-fitting seemed to work fine in very limited testing. When I went to compare the older method, with auto-fitting turned off, I started with this:


      Screen shot 2012-05-23 at 3.24.03 PM.PNG


      The repeated part of my script looked like this:


      var frame = app.activeDocument.textFrames[0];
      frame.contents += frame.contents;


      I got this:


      Screen shot 2012-05-23 at 3.24.40 PM.PNG


      Uh oh. The frame resized out to the pasteboard margins.


      It works fine, as it always has, in the UI. And it will do okay from the scripting interface with two different scripts:


      var frame = app.activeDocument.textFrames[0];
      frame.contents += frame.contents;


      and then:


      var frame = app.activeDocument.textFrames[0];


      But not together. I tried putting in an alert and some other stuff in between the text doubling and the fit, but that didn't fix it.


      Anyone with CS6 care to try to replicate this one? (I'm on OS X 10.6.8.)



        • 1. Re: textFrame.fit() in CS6
          Green4ever Level 3

          For inserting the contents can you try something like this,



          frame.insertionPoints[-1].contents = frame.contents;



          I don't think it will solve your problem, but anyway give a blind guess/try and see what will happen.


          Edit: I don't have CS6 to test it...




          • 2. Re: textFrame.fit() in CS6
            absqua Level 4

            Doubling the text your way doesn't trigger the bug. Other modifications made to the entire story (like setting frame.parentStory.pointSize += 1 or frame.parentStory.tracking = 999) will trigger it; but smaller changes, like frame.words[-1].pointSize *= 2 won't, even if they overset the frame. But setting frame.contents += "a", though it's a modification to the entire story, won't trigger it. It seems that InDesign is tracking the text frames' fit, even with auto-fitting turned off, and doesn't refresh itself properly after (some) scripted modifications to the frame's contents. Or something? I don't know. I'll report the bug.