14 Replies Latest reply on Nov 7, 2017 6:55 AM by Silly-V

    Overflows property update process

    Loic.Aigon Adobe Community Professional

      Hi all,

       

      I am working on some process that produces unexpected results. It's a xml-based label production workflow and once the text is placed, I intend to fit it the best way. So basically I start setting a wide value and decrement through loop. My exit condition is that the story may not overflow.

       

      My main concern is that overflow value seems updated quite late. Given the picture, it stopped at 10pts like obvisously it should have stopped sooner like 11 or maybe 12pts. But looking at my log, the overflow returns true for those values. However if I apply them by hand it's perflecty ok.

       

      I also tried to call recompose and re-set reference for my story being tweaked (pointSize and leading) or using IDs but none of them changed anything.

      So I am really confused here. How reliable overflow is and what would be the best approach for you in this case ?

       

      Capture d’écran 2016-02-19 à 13.45.42.png

       

      //xe is a XMLElement Reference
      var main = function(xe) { 
        var t = xe.texts[0].parentStory;
      
        t.pointSize = 36;
        t.leading = t.pointSize*1.2;
      
        while ( t.overflows ) {
        t.pointSize-=.5;
        t.leading = t.pointSize*1.2;
        }
      }
      

       

      Thanks in advance for your ideas.

       

      Loic