Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Server Developers
Viewing all articles
Browse latest Browse all 20709

Equal height columns, and text frame overflow detection

$
0
0

I'm trying to write some Javascript that will shrink a 4 column TextFrame to the minimum height required to fit all the text.

 

 

while(!bodyTextFrame.overflows) {

     var bounds = bodyTextFrame.geometricBounds;

     bodyTextFrame.geometricBounds = [bounds[0], bounds[1], bounds[2] - gridHeight, bounds[3]];

}

 


 

var bounds = bodyTextFrame.geometricBounds;

bodyTextFrame.geometricBounds = [bounds[0], bounds[1], bounds[2] + (1 *gridHeight), bounds[3]];

 

 

We break out of the while loop when the bodyTextFrame has just overflowed, so afterwards we add one more line back, and it shouldn't overflow.

 

What actually happens is that it overshoots the desired result, making the TextFrame smaller than is necessary, often by about 10 lines.

 

I've noticed something similar with overflow detection in other situations, such as just after applying a ParagraphStyle to the entire TextFrame. It seems to have a delay in detecting the overflow - like it's issued the command but behind the scenes the UI hasn't refreshed before moving onto the next line. If I come back to the TextFrame in question in a later part of the script it can detect that it has overflowed completely fine.

 

Is there anything I'm missing here? Can I force it to wait to ensure that the bodyTextFrame has completely refreshed before moving onto the next line/loop?

 

Thanks a lot!


Viewing all articles
Browse latest Browse all 20709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>