Fit Text to Box

Build 1501 on 14/Nov/2017  This topic last edited on: 28/Oct/2016, at 11:48

The algorithm goes like this:

If the text has previously been adjusted, remove last time’s adjustments.

If the text is currently overset:

 Try the maximum allowed amount of shrink.

 If the text is still overset

         Give up – there is too much text

 Choose the minimum amount of shrink that fixes the overset

Otherwise

 Try the maximum allowed amount of stretch

 If the text is now overset

         Choose the minimum stretch that does not overset

 Otherwise, if the box still has plenty of spare space

         Give up – there is too little text

 Otherwise

         Retain this maximum stretch

The adjustments are then saved as a box slug.