17 Replies Latest reply on Jul 29, 2014 9:21 AM by Obi-wan Kenobi

    Slanted rectangle behind text — any chance to automate the process?

    ChristianAaltonen Level 1

      Hi there,

       

      I would like to create effect which you can see on this image:

       

      GYNGlkb.jpg

       

      The black and orange rectangles behind the capitals. The source which is pictured above comes from professional studio. They put separate rectangle behind the textframe:

       

      qyvwbAW.jpg

       

      Imagine, that you create a catalog of 500 products. Each product has one black and one color rectangle. There are 20 different color codes for the bottom rectangle (these rectangles vary a bit in length, depending on the size of the text above). I feel putting a square object to the bottom layer like a bit clumsy approach. It is like creating paragraph dividers by Line Tool. Could you recommend some more tidier way for this? I am almost sure, that I will put a thousand of those rectangles to the layout and the client will decide ( a day before print), that "the reversed skew would look more professional"…

       

      The best way for this would be a Paragraph rule, but — what a surprise — no chance to skew the ends.

      I tried to create the new stroke preset, but no skew options.

      I also skewed the line manually and try to create the Object Style from it. The skew was not inherited by the new Object Style.

      Do I really do this manually in the age of spaceflights, cellphones and even electric tea kettles?

       

      Thank you!

        • 1. Re: Slanted rectangle behind text — any chance to automate the process?
          MW Design Level 4

          Create a library.

          File | New | Library

           

          After you create it, drag your design elements into it. Drag them onto the page where/when needed.

           

          I have a few dozens for various items.

           

          capture-001678.png

          • 2. Re: Slanted rectangle behind text — any chance to automate the process?
            ChristianAaltonen Level 1

            Awesome mate! You are a genius!

             

            Thank you for your time & effort.

            • 3. Re: Slanted rectangle behind text — any chance to automate the process?
              MW Design Level 4

              Hah--genius I'm not.

               

              Most of this stuff I have learned here or over at http://indesignsecrets.com/

               

              For instance, a quick search there has this article:

              http://indesignsecrets.com/fun-indesign-libraries.php

              • 4. Re: Slanted rectangle behind text — any chance to automate the process?
                ChristianAaltonen Level 1

                There is no connection between placed objects and the library, like Symbols in Ai. But if I create the object in Ai, save as separate file and import it as a link to Id, it works like Symbol. The link can be edited in Ai and all the placed instances can be refreshed at once.

                 

                Thank you again…

                • 5. Re: Slanted rectangle behind text — any chance to automate the process?
                  MW Design Level 4

                  You're welcome.

                   

                  BTW, you can place an AI file (or any file), drag it into the Library window, delete the original off the page. When you drag it out of the Library window onto the page, the link is automatically created.

                   

                  So, I have some reusable AI, EPS, PSD, etc., files also in some of the libraries I have. I did the above into the sample library I created. The AI file link is created automatically as can be seen in the screen shot. Same with all linked files, modify the original and update the links, presto. The main reason I have them in libraries is for the re-usability on publications for the same client. In general, I save them to the same folder I use for saving the library to. Some libraries are located in the top-level client folder, others are in a general Library folder.

                   

                  capture-001679.png

                   

                  Take care, Mike

                  • 6. Re: Slanted rectangle behind text — any chance to automate the process?
                    rob day Adobe Community Professional & MVP

                    You could also do this with a single text frame set to Align Center and the Baseline Options First Baseline Offset set to Ascent, which makes accurate center alignment easier:

                     

                    Screen Shot 2014-07-20 at 9.21.05 AM.png

                     

                    You could also consider putting the text frames on Master Pages so editing is just a matter of releasing the MP item rather than getting it from a library

                    • 7. Re: Slanted rectangle behind text — any chance to automate the process?
                      MW Design Level 4

                      Hmm. I further responded last night and it is not here, nor is the OP's additional post. I really, really hate this new forum software.

                       

                      If I wasn't using a catalog plug-in, I would design the whole page with an image frame and the various text frames and the slanted text boxes. A complete page design for the various sizes. If one is using AI files (or PSD files, etc.), then link those in the page layout. The links are maintained in the library.

                       

                      This whole page design can be dropped into the library and dragged onto each page as appropriate. If a change to say one of the slanted rectangles needs made, then the whole layout(s) are updated.

                       

                      Mike

                      • 8. Re: Slanted rectangle behind text — any chance to automate the process?
                        rob day Adobe Community Professional & MVP

                        If a change to say one of the slanted rectangles needs made, then the whole layout(s) are updated.

                         

                        Is there an advantage to that over simply having them on master pages?

                        • 9. Re: Slanted rectangle behind text — any chance to automate the process?
                          MW Design Level 4

                          Rob,

                           

                          Ultimately, I don't know the answer to your question.

                           

                          The library thing is great for various but repeating layouts in a catalog (and they can be used in merges, too). As far as the AI graphics...the slanted boxes...there are advantages and disadvantages I suppose. I don't know the whole layout for the OP's catalog, but I hate creating more than a few master pages and overriding them on local pages. Perhaps the one main reason I don't like overriding when one has a catalog is the file bloat that can come from doing so. My own issue is that I can lose track of making changes and then inspecting pages that are overridden versus not overridden.

                           

                          The last catalog I did wholly via manual efforts would have had perhaps 17 master pages for the various sections. Maybe more. Whether creating the required number of master pages or designing on a blank page and dragging it into a library for reuse within the publication and for use later on in subsequent catalogs is easier/better? Dunno.

                          • 10. Re: Slanted rectangle behind text — any chance to automate the process?
                            Obi-wan Kenobi Adobe Community Professional

                            Hi,

                             

                            To do this, I use Grep and Keyboard shortcuts.

                             

                            First, I create the reference para style "Underline_1_Orange. Then, based on it, the others para styles I need.

                             

                            Capture d’écran 2014-07-20 à 23.07.52.png

                             

                            The first tip I use is a normal paragraph rule.

                            The second tip: I insert a grep style, as:

                             

                            Capture d’écran 2014-07-20 à 23.16.37.png

                             

                            And finally, I use a Grep search to insert in the text an element placed beside the page:

                             

                            Capture d’écran 2014-07-20 à 23.08.27.png

                             

                            Capture d’écran 2014-07-20 à 23.08.40.png

                             

                            I replace ALL!

                             

                            Capture d’écran 2014-07-20 à 23.09.12.png

                             

                            Now, All I have to do is apply the good styles (using shortcuts).

                             

                            Capture d’écran 2014-07-20 à 23.09.48.png

                             

                            Cool! 

                            • 11. Re: Slanted rectangle behind text — any chance to automate the process?
                              ChristianAaltonen Level 1

                              Well, that's the Magic! I definitely have to try this!

                              Thaks for sharing Obi!

                              • 12. Re: Slanted rectangle behind text — any chance to automate the process?
                                ChristianAaltonen Level 1

                                Once again Thank you for sharing, but let me ask: You say: "And finally, I use a Grep search to insert in the text an element placed beside the page" What kind of  "element" did you use? Did you drawed it by Pen Tool? You can insert such element INTO the textfield between letters?

                                 

                                So you just covered the front and rear part of the line by element of the same color as the background is — am I right?

                                 

                                Thank you Obi!

                                • 13. Re: Slanted rectangle behind text — any chance to automate the process?
                                  Obi-wan Kenobi Adobe Community Professional

                                  The "mask" is only a simple rectangle block anchored between 2 spaces as:

                                   

                                  Capture d’écran 2014-07-21 à 00.32.50.png

                                   

                                  Capture d’écran 2014-07-21 à 00.33.11.png

                                   

                                  If you want, give me an email in private: I send you the ID file (.idml).

                                  • 14. Re: Slanted rectangle behind text — any chance to automate the process?
                                    rob day Adobe Community Professional & MVP

                                    You could also do it with a reverse tracked, square Zapf Dingbat glyph.

                                     

                                    So, an orange dingbat followed by the text:

                                     

                                    Screen Shot 2014-07-21 at 6.56.37 AM.png

                                     

                                    The dingbat with 400% horizontal scaling and negative baseline shift

                                     

                                    Screen Shot 2014-07-21 at 6.58.24 AM.png

                                     

                                     

                                    Finally with a 21 degree skew and -590 tracking, which centers the text over the glyph.

                                     

                                    Screen Shot 2014-07-21 at 7.00.17 AM.png

                                    • 15. Re: Slanted rectangle behind text — any chance to automate the process?
                                      Obi-wan Kenobi Adobe Community Professional

                                      Hi Rob,

                                       

                                      Solution totally dependent on the length of the string behind the Dingbats glyph.

                                      Not easy to play it in these case too!

                                      Capture d’écran 2014-07-21 à 13.24.39.png

                                       

                                      Capture d’écran 2014-07-21 à 13.58.51.png

                                       

                                      Capture d’écran 2014-07-21 à 14.10.00.png

                                      • 16. Re: Slanted rectangle behind text — any chance to automate the process?
                                        ChristianAaltonen Level 1

                                        Well, also nice approach — dependent on the string-length, but pretty clever anyway.

                                         

                                        Thank you!

                                        • 17. Re: Slanted rectangle behind text — any chance to automate the process?
                                          Obi-wan Kenobi Adobe Community Professional

                                          Hi all,

                                           

                                          Marc Autret has confirmed me his OK to unveil this great code.


                                          AjustementMagique.jsx permits a horizontal "scaling", in particular for tables. It works fine with ID CS4 (a very little bug sometimes). Not tested with CS5.


                                          But ... it does not work under ID CS6, CC and CC 2014!


                                          Marc gives his blessing to the heroes who would wish to do the update! 


                                          Enjoy!


                                          /***********************************************************************/

                                          /*                                                                     */

                                          /*      AjustementMagique pour InDesign CS / CS2 -- 18/01/06           */

                                          /*      version 2.1b (FR) -- auteur: Marc Autret                       */

                                          /*                                                                     */

                                          /*      Explications : http://marcautret.free.fr/geek/indd/magicfit/   */

                                          /*                                                                     */

                                          /*      Installation et Utilisation:                                   */

                                          /*                                                                     */

                                          /*      0) !! Pour InDesign CS2 seulement !!                           */

                                          /*         Renommez le present fichier avec l'extension .jsx           */

                                          /*         (afin d'activer les fonctions extend script)                */

                                          /*                                                                     */

                                          /*      1) Placer le present fichier dans le sous-dossier              */

                                          /*         Presets/Scripts/ de l'application InDesign                  */

                                          /*                                                                     */

                                          /*      2) Lancer InDesign, ouvrir un document et selectionner         */

                                          /*         le(s) elements(s) a ajuster: bloc(s), colonnes(s)           */

                                          /*         [a defaut, le script ajuste le conteneur du pt d'insertion] */

                                          /*                                                                     */

                                          /*      3) Executer le script par Fenetre>Scripts>Scripts              */

                                          /*         suivi d'un double-clic sur AjustementMagique.js             */

                                          /*         (ou affecter au script un raccourci-clavier via             */

                                          /*         Edition>Raccourcis-clavier>Zone:"scripts")                  */

                                          /*                                                                     */

                                          /*      4) Un second appel du script sous un delai de 2 secondes       */

                                          /*         optimise si c'est possible l'ajustement (mode "fluide")     */

                                          /*                                                                     */

                                          /*                  Feedbacks : marcautret@free.fr                     */

                                          /*                                                                     */

                                          /***********************************************************************/

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // REGLAGES

                                          //----------------------------------------------------------

                                           

                                           

                                          var LATENCE = 2; // en secondes (defaut: 2)

                                          var PRECISION = 0.5; // en points (defaut:0.5)

                                          var APP_INT_VERSION = parseInt(app.version);

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // UTILITAIRES

                                          //----------------------------------------------------------

                                           

                                           

                                           

                                           

                                          /*void*/ function exitMessage(/*exception*/ ex)

                                          //----------------------------------------------------------

                                          {

                                          alert("Erreur:\n" + ex.toString());

                                          exit();

                                          }

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // METHODES DE LA CLASSE DOCUMENT

                                          //----------------------------------------------------------

                                           

                                           

                                           

                                           

                                          /*void*/ Document.prototype.setUnitsTo = function(/*units*/ newUnits)

                                          //----------------------------------------------------------

                                          // units est soit une valeur simple (horiz=vert), soit un array(horizUnits, vertUnits)

                                          {

                                          var arrUnits = (newUnits.length) ? newUnits : new Array(newUnits,newUnits);

                                          this.viewPreferences.horizontalMeasurementUnits = arrUnits[0];

                                          this.viewPreferences.verticalMeasurementUnits = arrUnits[1];

                                          }

                                           

                                           

                                          /*arr2*/ Document.prototype.getUnits = function()

                                          //----------------------------------------------------------

                                          {

                                          return(Array(

                                            this.viewPreferences.horizontalMeasurementUnits,

                                            this.viewPreferences.verticalMeasurementUnits));

                                          }

                                           

                                           

                                          /*bool*/ Document.prototype.withinDelay = function()

                                          //----------------------------------------------------------

                                          {

                                          if (this.label)

                                            return( (Date.parse(Date())-this.label) <= LATENCE*1000 );

                                          return(false);

                                          }

                                           

                                           

                                          /*void*/ Document.prototype.storeTimeStamp = function()

                                          //----------------------------------------------------------

                                          {

                                          this.label = Date.parse(Date()).toString();

                                          }

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // METHODES GENERIQUES (NIVEAU OBJECT)

                                          //----------------------------------------------------------

                                           

                                           

                                           

                                           

                                          /*arr*/ Object.prototype.asObjsToFit = function()

                                          //----------------------------------------------------------

                                          // Retourne le(s) "conteneur(s) ajustable(s)" associe(s) a THIS

                                          // Type de retour: array OU collection

                                          // NULL en cas d'echec

                                          {

                                          switch(this.constructor.name)

                                            {

                                            case "TextFrame" : // textframe -> singleton this

                                            return(Array(this));

                                           

                                           

                                            case "Cell" : // cells -> parent columns

                                            var r = new Array();

                                            // !! [CS1] Cell::parentColumn === Cell !!

                                            // !! [CS2] Cell::parentColumn === Column !!

                                            // !! [CS2] Cells::lastItem().parentColumn BUG !!

                                            var c0 = this.cells.firstItem().name.split(":")[0];

                                            var c1 = this.cells.lastItem().name.split(":")[0];

                                            for (var i=c0 ; i<=c1; i++)

                                            r.push(this.parent.columns[i]);

                                            return(r);

                                           

                                           

                                            case "Table" /*CS2*/ : // table -> columns

                                            return(this.columns);

                                           

                                           

                                            case "Group" : // group -> textFrames

                                            return((this.textFrames.length>0) ? this.textFrames : null);

                                           

                                           

                                            case "Text" : // Text ou InsertionPoint

                                            case "InsertionPoint" : // -> travailler sur le conteneur

                                            var textContainer = this.getTextContainer();

                                            return((textContainer) ? textContainer.asObjsToFit() : null);

                                           

                                            default:

                                            return(null);

                                            }

                                          }

                                           

                                           

                                          /*obj*/ Object.prototype.getTextContainer = function()

                                          //----------------------------------------------------------

                                          // Renvoie le TextFrame ou la cellule (Cell) contenant THIS

                                          // (Text ou InsertionPoint)

                                          // NULL si echec

                                          {

                                          try { // try...catch because of CS2 behaviour

                                            if (this.parent.constructor.name == "Cell")

                                            return(this.parent);

                                            if (this.parentTextFrames) // pluriel sous CS2

                                            return(this.parentTextFrames[0]);

                                            if (this.parentTextFrame) // sing. sous CS1

                                            return(this.parentTextFrame);

                                            return(null);

                                            }

                                          catch(ex) {return(null);}

                                          }

                                           

                                           

                                          /*int*/ Object.prototype.computeIncludedObjectsWidth = function()

                                          //----------------------------------------------------------

                                          // Analyse les objets incorpores (tables, PageItems) pour extraire

                                          // la largeur maxi qu'ils occupent

                                          {

                                          // Le tableau objsNames peut etre etendu pourvu que

                                          // l'objet ajoute fournisse une methode computeWidth()

                                          var objsNames = new Array("pageItems","tables");

                                          var objsWidth = 0;

                                          var w = 0;

                                           

                                           

                                          for (var j=objsNames.length-1 ; j>=0 ; j--)

                                            {

                                            for (var i=this[objsNames[j]].length-1 ; i>=0 ; i--)

                                            {

                                            try

                                            {w = this[objsNames[j]][i].computeWidth({VISIBLE:true});}

                                            catch(ex)

                                            {w=0;}

                                            if (w > objsWidth) objsWidth=w;

                                            }

                                            }

                                          return(objsWidth);

                                          }

                                           

                                           

                                          /*int*/ Object.prototype.computeWidth = function(/*bool*/ VISIBLE)

                                          //----------------------------------------------------------

                                          // Methode generique pour les composants possedant des Bounds

                                          // VISIBLE true -> largeur EXTERNE

                                          // VISIBLE false -> largeur INTERNE

                                          {

                                          if (VISIBLE)

                                            {

                                            if (this.visibleBounds)

                                            return(this.visibleBounds[3]-this.visibleBounds[1]);

                                            }

                                          else

                                            {

                                            if (this.geometricBounds)

                                            return(this.geometricBounds[3]-this.geometricBounds[1]);

                                            }

                                          return(0);

                                          }

                                           

                                           

                                          /*int*/ Table.prototype.computeWidth = function()

                                          //----------------------------------------------------------

                                          // Specialise Object::computeWidth dans le cas d'une Table

                                          {

                                          return(this.width);

                                          }

                                           

                                           

                                          /*arr*/ Object.prototype.createLinesSizesArray = function()

                                          //----------------------------------------------------------

                                          // Renvoie sous forme de tabeau la taille (en cars) des lignes de THIS

                                          // Tableau vide si this.lines==NULL  OU  this.lines.length==0

                                          {

                                          r = new Array();

                                          if (this.lines)

                                            for (var i=this.lines.length-1; i>=0 ; i--)

                                            r.unshift(this.lines[i].characters.length);

                                          return(r);

                                          }

                                           

                                           

                                          /*bool*/ Object.prototype.isoceleLines = function(/*arr*/ arrSizes)

                                          //----------------------------------------------------------

                                          // Indique si THIS.lines[i].characters.length == arrSizes[i] pour tout i

                                          {

                                          if (this.lines.length != arrSizes.length) return(false);

                                          for (var i=arrSizes.length-1 ; i>=0 ; i--)

                                            if (arrSizes[i] != this.lines[i].characters.length)

                                            return(false);

                                          return(true);

                                          }

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // METHODES SPECIFIQUES A TEXTFRAME

                                          //----------------------------------------------------------

                                           

                                           

                                           

                                           

                                          /*bool*/ TextFrame.prototype.isEmpty = function()

                                          //----------------------------------------------------------

                                          {

                                          return(this.characters.length==0);

                                          }

                                           

                                           

                                          /*bool*/ TextFrame.prototype.isOverflowed = function()

                                          //----------------------------------------------------------

                                          {

                                          return(this.overflows);

                                          }

                                           

                                           

                                          /*int*/ TextFrame.prototype.getWidth = function()

                                          //----------------------------------------------------------

                                          {

                                          return(this.computeWidth({VISIBLE:false}));

                                          }

                                           

                                           

                                          /*void*/ TextFrame.prototype.resizeWidthBy = function(/*int*/ widthOffset)

                                          //----------------------------------------------------------

                                          // Redimensionne la largeur de widthOffset (signe)

                                          {

                                          this.geometricBounds = Array(

                                            this.geometricBounds[0],

                                            this.geometricBounds[1],

                                            this.geometricBounds[2],

                                            this.geometricBounds[3] + widthOffset);

                                          }

                                           

                                           

                                          /*int*/ TextFrame.prototype.computeMinWidth = function()

                                          //----------------------------------------------------------

                                          // Renvoie la largeur mini du bloc compte tenu des objets

                                          // incorpores et de l'espacement interne (inner space)

                                          {

                                          var inSpace = this.textFramePreferences.insetSpacing;

                                          var inWidth = (inSpace.length) ?

                                            inSpace[1] + inSpace[3] : // inspace gauche et droit distincts

                                            2*inSpace; // inspace uniforme

                                           

                                           

                                          return(this.computeIncludedObjectsWidth() + inWidth);

                                          }

                                           

                                           

                                          /*int*/ TextFrame.prototype.getCharsCount = function()

                                          //----------------------------------------------------------

                                          {

                                          return(this.characters.length);

                                          }

                                           

                                           

                                          /*int*/ TextFrame.prototype.getLinesCount = function()

                                          //----------------------------------------------------------

                                          {

                                          return(this.lines.length);

                                          }

                                           

                                           

                                          /*arr*/ TextFrame.prototype.getLinesSizes = function()

                                          //----------------------------------------------------------

                                          {

                                          return(this.createLinesSizesArray());

                                          }

                                           

                                           

                                          /*int*/ TextFrame.prototype.preserveCharsCount = function(/*int*/ charsCount)

                                          //----------------------------------------------------------

                                          // OUI -> -1  , NON -> 1

                                          {

                                          return( (this.characters.length != charsCount) ? 1 : -1 );

                                          }

                                           

                                           

                                          /*int*/ TextFrame.prototype.preserveLinesCount = function(/*int*/ linesCount)

                                          //----------------------------------------------------------

                                          // Indique si:

                                          // - nb de chars = linesCount

                                          // - le bloc NE DEBORDE PAS

                                          // OUI -> -1  , NON -> 1

                                          {

                                          return( ((this.overflows) || (this.lines.length != linesCount)) ? 1 : -1 );

                                          }

                                           

                                           

                                          /*int*/ TextFrame.prototype.preserveLinesSizes = function(/*arr*/ linesSizes)

                                          //----------------------------------------------------------

                                          // Indique si:

                                          // chaque ligne x est isocele a linesSizes[x]

                                          // YES -> -1  , NOT -> 1

                                          {

                                          return( (this.isoceleLines(linesSizes)) ? -1 : 1 );

                                          }

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // METHODES SPECIFIQUES A COLUMN

                                          //----------------------------------------------------------

                                           

                                           

                                           

                                           

                                          /*bool*/ Column.prototype.isEmpty = function()

                                          //----------------------------------------------------------

                                          {

                                          for (var i=this.cells.length-1; i>=0 ; i--)

                                            if (this.cells[i].characters.length>0) return(false);

                                          return(true);

                                          }

                                           

                                           

                                          /*bool*/ Column.prototype.isOverflowed = function()

                                          //----------------------------------------------------------

                                          // Indique si au moins une cellule est saturee

                                          // !! ATTENTION: Column::overflows n'est pas fiable !!

                                          {

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            if (this.cells[i].overflows) return(true);

                                          return(false);

                                          }

                                           

                                           

                                          /*int*/ Column.prototype.getWidth = function()

                                          //----------------------------------------------------------

                                          {

                                          return(this.width);

                                          }

                                           

                                           

                                          /*void*/ Column.prototype.resizeWidthBy = function(/*int*/ widthOffset)

                                          //----------------------------------------------------------

                                          // Redimensionne la largeur de colonne de widthOffset (signe)

                                          // !! Il faut RAFRAICHIR l'affichage !!

                                          {

                                          this.width += widthOffset;

                                           

                                           

                                          // rafraichissement

                                          if (APP_INT_VERSION > 3)

                                            // CS2+

                                            this.recompose();

                                          else

                                            {

                                            // CS -- merci a Tilo pour ce hack --

                                            for(var i = this.cells.length - 1 ; i >= 0 ; i-- )

                                            {

                                            // Ce test stupide provoque le rafraichissement!

                                            if (this.cells[i].contents == null) {}

                                            }

                                            }

                                          }

                                           

                                           

                                          /*int*/ Column.prototype.computeMinWidth = function()

                                          //----------------------------------------------------------

                                          // Renvoie la largeur mini de la colonne compte tenu des

                                          // objets incorpores et de l'espacement interne

                                          {

                                          var iCell = null;

                                          var w = 0;

                                          var r = 0;

                                           

                                           

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            {

                                            iCell = this.cells[i];

                                            w = iCell.computeIncludedObjectsWidth() +

                                            iCell.leftInset + iCell.rightInset;

                                            if (w > r) r = w;

                                            }

                                          return(r);

                                          }

                                           

                                           

                                          /*arr*/ Column.prototype.getCharsCount = function()

                                          //----------------------------------------------------------

                                          // Renvoie (tableau) le nb de cars de chaque cellule

                                          // si la cellule est saturee, le nb de cars est signe negativement

                                          {

                                          var r = new Array();

                                          var sgn = 0;

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            {

                                            sgn = (this.cells[i].overflows) ? -1 : 1;

                                            r.unshift(sgn * this.cells[i].characters.length);

                                            }

                                          return(r);

                                          }

                                           

                                           

                                          /*arr*/ Column.prototype.getLinesCount = function()

                                          //----------------------------------------------------------

                                          // Renvoie (tableau) le nb de lignes par cellules

                                          {

                                          var r = new Array();

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            r.unshift(this.cells[i].lines.length);

                                          return(r);

                                          }

                                           

                                           

                                          /*bi-arr*/ Column.prototype.getLinesSizes = function()

                                          //----------------------------------------------------------

                                          // Renvoie le nb de chars par cellule et par ligne (matrice)

                                          {

                                          var r = new Array();

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            r.unshift(this.cells[i].createLinesSizesArray());

                                          return(r);

                                          }

                                           

                                           

                                          /*int*/ Column.prototype.preserveCharsCount = function(/*arr*/ charsCount)

                                          //----------------------------------------------------------

                                          // Indique si:

                                          // le signe de debordement (overflow) de la cellule X egale sgn(charsCount[X])

                                          // OUI -> -1  , NON -> 1

                                          {

                                          var sgn = 0;

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            {

                                            sgn = (this.cells[i].overflows) ? -1 : 1;

                                            if (sgn * charsCount[i] < 0) return(1);

                                            }

                                          return(-1);

                                          }

                                           

                                           

                                          /*int*/ Column.prototype.preserveLinesCount = function(/*arr*/ linesCount)

                                          //----------------------------------------------------------

                                          // Indique si:

                                          // - le compte de lignes de la cellule x egale linesCount[x]

                                          // - aucune cellule ne deborde

                                          // OUI -> -1  , NON -> 1

                                          {

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            {

                                            if (this.cells[i].overflows) return(1);

                                            if (this.cells[i].lines.length != linesCount[i]) return(1);

                                            }

                                          return(-1);

                                          }

                                           

                                           

                                          /*int*/ Column.prototype.preserveLinesSizes = function(/*bi-arr*/ linesSizes)

                                          //----------------------------------------------------------

                                          // Indique si:

                                          // - dans chaque cellule x, chaque LIGNE y est isocele a linesSizes[x][y]

                                          // (si une cellule deborde, renvoie 1)

                                          // OUI -> -1  , NON -> 1

                                          {

                                          for (var i=this.cells.length-1 ; i>= 0 ; i--)

                                            {

                                            if (this.cells[i].overflows) return(1);

                                            if (this.cells[i].isoceleLines(linesSizes[i]) == false) return(1);

                                            }

                                          return(-1);

                                          }

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // METHODES CENTRALES

                                          //----------------------------------------------------------

                                           

                                           

                                           

                                           

                                          /*void*/ Object.prototype.manageFit = function(/*bool*/ FLUIDFITTING)

                                          //----------------------------------------------------------

                                          {

                                          // !! Sous CS2, previent un crash sur les "grosses" selections multicolonnes !!

                                          // !! Thx to Tilo for this hack --

                                          if (APP_INT_VERSION>=4)

                                            {

                                            $.gc();

                                            }

                                                

                                          // ne rien faire si objet vide

                                          if (this.isEmpty()) return;

                                           

                                           

                                          // largeur mini a preserver

                                          var minWidth = this.computeMinWidth();

                                           

                                           

                                          // let's go!

                                          this.processFit(FLUIDFITTING, minWidth);

                                          }

                                           

                                           

                                           

                                           

                                          /*void*/ Object.prototype.processFit = function(/*bool*/ FLUIDFITTING, /*int*/ minWidth)

                                          //----------------------------------------------------------

                                          // Ajuste cet objet en largeur

                                          // FLUIDFITTING true -> methode fluide, sinon: methode stricte

                                          // minWidth fixe le seuil minimal

                                          {

                                          if (FLUIDFITTING)

                                            { // AJUSTEMENT FLUIDE

                                            if (this.isOverflowed())

                                            { // NB : les cellules saturees sont "transparentes" (negligees)

                                           

                                            var charsCount = this.getCharsCount();

                                            var evalFlag = function(thisObj)

                                            {return(thisObj.preserveCharsCount(charsCount));}

                                            }

                                            else

                                            {

                                            var linesCount = this.getLinesCount();

                                            evalFlag = function(thisObj)

                                            {return(thisObj.preserveLinesCount(linesCount));}

                                            }

                                            }

                                          else

                                            { // AJUSTEMENT STRICT

                                             // NB : les colonnes contenant 1 cellule saturee sont inchangees

                                           

                                            if ((this.constructor.name=="Column") && (this.isOverflowed()))

                                            return;

                                           

                                           

                                            var linesSizes = this.getLinesSizes();

                                            var evalFlag = function(thisObj)

                                            {return(thisObj.preserveLinesSizes(linesSizes));}

                                            }

                                           

                                           

                                          // BOUCLE DICHOTOMIQUE

                                           

                                           

                                          var sgnFLAG = -1;

                                          var w = ( this.getWidth() - minWidth ) / 2;

                                           

                                           

                                          while (w >= PRECISION)

                                            {

                                            // redim la largeur de +/- w

                                            this.resizeWidthBy(sgnFLAG*w);

                                           

                                            // +1 = augmenter | -1 = reduire

                                            sgnFLAG = evalFlag(this);

                                           

                                            // diviser le segment

                                            w = w/2;

                                            }

                                           

                                           

                                          // sortie avec sgnFLAG==+1 -> annuler la derniere reduction -> +2w

                                          if (sgnFLAG>0) this.resizeWidthBy(2*w);

                                          }

                                           

                                           

                                           

                                           

                                           

                                           

                                           

                                           

                                          //----------------------------------------------------------

                                          // PROGRAMME PRINCIPAL

                                          //----------------------------------------------------------

                                           

                                           

                                          if ( app.documents.length > 0 )

                                            {

                                            if ( app.activeWindow.selection.length > 0 )

                                            {

                                            try {

                                            var thisDoc = app.activeDocument;

                                            var FLUIDFLAG = thisDoc.withinDelay();

                                           

                                            var memUnits = thisDoc.getUnits();

                                            thisDoc.setUnitsTo(MeasurementUnits.points);

                                           

                                            var selObjs = app.activeWindow.selection;

                                            var objsToFit = null;

                                            for (var i=selObjs.length-1 ; i>=0 ; i--)

                                            {

                                            objsToFit = selObjs[i].asObjsToFit();

                                            if (objsToFit)

                                            {

                                            for (var j=objsToFit.length-1 ; j>=0 ; j--)

                                            objsToFit[j].manageFit(FLUIDFLAG);

                                            }

                                            }

                                           

                                            thisDoc.setUnitsTo(memUnits);

                                            thisDoc.storeTimeStamp();

                                            }

                                            catch(ex)

                                            {

                                            thisDoc.setUnitsTo(memUnits);

                                            exitMessage(ex);

                                            }

                                            }

                                           

                                            else

                                            alert("Aucun objet n'est selectionne!");

                                            }

                                          else

                                            alert("Aucun document n'est ouvert!");