2 Replies Latest reply on Oct 9, 2008 6:17 AM by CTC Imaging

    [JS] Formating Text Overflow

    CTC Imaging Level 1
      Hello everyone,

      Scenario: I have a word that needs content change AND kerning. This word is visible but it may be repeated in the Text Overflow portion of the frame. I am using "myWRDs = myTF.parentStory.search(....)" to change all occurences of the word. So by using a loop, I can access each words and "myWRDs[cpt].insertionPoints[1].kerningValue += 10". But the ones hidden in the Text Overflow, give an error.

      Goal: How can I do the kerning change w/o resizing the frame?
        • 1. Re: [JS] Formating Text Overflow
          Try something like this:

          var myDoc = app.activeDocument;
          resizeOversetContent();

          function resizeOversetContent() {
          var myStories = myDoc.stories;
          var myName = myDoc.paragraphStyles.item("Para Style"); //you must have the content using a specific style so you can edit.
          for (var j = myStories.length - 1; j >= 0; j--) {
          while (myStories[j].overflows == true) {
          if (myStories[j].appliedParagraphStyle == myName) {
          myName.minimumGlyphScaling = myName.minimumGlyphScaling - 1;
          myName.desiredGlyphScaling = myName.desiredGlyphScaling - 1;
          myName.minimumWordSpacing = myName.minimumWordSpacing - 0.1;
          myName.desiredWordSpacing = myName.desiredWordSpacing - 0.1;
          myName.minimumLetterSpacing = myName.minimumLetterSpacing - 0.725;
          myName.desiredLetterSpacing = myName.desiredLetterSpacing - 0.725;
          }}}}

          Let me know if this is what you're after.

          Brett
          • 2. Re: [JS] Formating Text Overflow
            CTC Imaging Level 1
            Thank you a lot.

            I understand what you are doing, but I cannot modify any other formatting but the perticular character's Kerning I am looking for. Also in case the user is exiting the program early, I cannot change the box size without being able to restore it. Also I am dealing with embedded textframes so I would be limited to the parent size as well.
            So my goal is to address the space between 2 characters (I believe it would be an inserpoint) in overflow text. Maybe I am approaching it incorrectly.