[BOXFIT] : Re-sizing Box to Fit Text Inside

Navigation:  Tokens > Layout Tokens >

[BOXFIT] : Re-sizing Box to Fit Text Inside

Previous pageReturn to chapter overviewNext page

The [BOXFIT] token (note the all uppercase) is used to tell Q++ to increase the size of a textbox by a certain amount, repeatedly until there is no more text overflow, or until the box has increased in width or height until a set maximal value. Optionally, a second direction can be specified, if the maximal height or width is reached and there is still some text overflow.

 

The syntax is :

 

[BOXFIT:rW1+x1(:dH1+y1)(:lW2+x2)(:uH2+y2)]

 

Where one or more of the r-l-u-d directions can be used, and where the grayed items are to be replaced by values as described below:

 

W1

Maximum width of the box when increasing to the right.

W2

Maximum width of the box when increasing to the left.

x1

Increase in width to use, when expanding to the right, before verifying that there is either no more text overflow, or that the maximum value of W1 has been reached.

x2

Increase in width to use, when expanding to the left, before verifying that there is either no more text overflow, or that the maximum value of W2 has been reached.

H1

Maximum width of the box when increasing downward.

H2

Maximum width of the box when increasing upward.

y1

Increase in height to use, when expanding down, before verifying that there is either no more text overflow, or that the maximum value of H1 has been reached.

y2

Increase in height to use, when expanding up, before verifying that there is either no more text overflow, or that the maximum value of H2 has been reached.

 

For example:

 

[BOXFIT:d150.6+6.5] would increase the box downwards repeatedly by 6.5pts until there is no more text overflow, or until the box is 150.6 points high.

[BOXFIT:r58+4.5:d203.2+21.3] would increase the box to the right repeatedly by 4.5pts until there is no more text overflow, or until the box is 58 points wide. At that point, if there is still some text overflow, then the box height would be increased downward in steps of 21.3pts until there is no more text overflow or a maximum height of 203.2pts is reached.

 

Some important points :

 

This token will only increase the size of its containing box; it will never shrink the box. Therefore you should always make the textbox small enough in the template, so that text overflow occurs in all circumstances (unless you wish to have a minimum size, regardless of the contents).

If there is no text overflow at the beginning of the processing of a BOXFIT token, then a warning message will be issued. If you do not wish to be alerted to the fact that the resulting textbox might be too big for the text inside, then use the [BOXGROW] token instead.

If you specify more than one direction, then Q++ will proceed in one direction, until the maximum size is reached, or text overflow has disappeared, before proceeding in the second direction.

Units of measurement are points.

You can use either a period or a comma as decimal separator.

Although you do not need to use a DayValue, internally Q++ will assume the DayValue to be 1 if there is no DavValue specified in the token. Therefore, you might want to always specify a DayValue corresponding to the lowest valued DayValue of the page on which the textbox is (the same way as you do for DayValue Marker tokens).

The position of this token in a textbox is not important, but we suggest you always place it at the beginning of a textbox, to make it easier later to see which boxes are using such tokens.

 

This token is particularly useful for tokens that may convert to text that spans multiple lines, particularly if this text has a leading that is different from the space between lines behind the text, as shown in the example below.

 

 

In the above example, the textbox containing the token was made non-transparent, with a white background color, so that the expanding box would hide more and more lines, as it expanded.

 

See also: Box Growing Tokens, Delete Characters Token.


Topic 177515 updated on 13-Aug-2016.
Topic URL: http://www.qppstudio.net/webhelp/index.html?boxfitboxre-sizing(new).htm