Please enable JavaScript to view this site.

 

Navigation: Tokens > Layout Tokens

[BOXFIT] Re-Sizing Box to Fit Text Inside

Scroll Prev Up Next More

The [BOXFIT] token (note the all uppercase) is used 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.

 

If you are using QuarkXPress, then the behavior of this token depends on the version of QuarkXPress that you are using.

 

Using QuarkXPress 2016-2024

 

Beginning with build 20694 (April 2019), when using QuarkXPress 2016-2024, any box containing a BOXFIT token, with a step size of 2 points or less, and that does not have text overflow initially, will be automatically be reduced in size to 3 points, to ensure text overflow, before the actual BOXFIT processing begins.

 

The limit of 2 points for the pre-shrinking of textboxes, mentioned above, is meant to allow for the use of leading-size steps, in particular when increasing a textbox vertically to just fit the right number of lines of text.

 

Using QuarkXPress 5-2015

 

When using QuarkXPress 5-2015, the BOXFIT 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 you wish to only grow the textbox if needed, but never shrink it, then use the [BOXGROW] token instead.

 

Optional Second Direction

 

Optionally, a second direction can be specified, if the maximal height or width is reached and there is still some text overflow.

 

Anchored textboxes using BOXFIT tokens to ensure that each box is exactly the needed width. Note the placement of the BOXFIT token at the bottom of the textboxes to guarantee text overflow if any of the tokens run to a second line.

Anchored textboxes using BOXFIT tokens to ensure that each box is exactly the needed width. Note the placement of the BOXFIT token at the bottom of the textboxes to guarantee text overflow if any of the tokens run to a second line.

 

Syntax

 

The BOXFIT tokens 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.

 

Examples

 

[BOXFIT:d150.6+6.5]

Increase the box downwards repeatedly by 6.5 points until there is no more text overflow, or until the box is 150.6 points high.

[BOXFIT:r58+4.5:d203.2+21.3]

Increase the box to the right repeatedly by 4.5 points 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.3 points (the leading) until there is no more text overflow or a maximum height of 203.2 points is reached.

 

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.

 

Important points to note

 

If you are using QuarkXPress 5-2015:

othis 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, in which case you should probably use a BOXGROW token instead).

oIf 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 the increase 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 DayValue will be assumed 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, to avoid the token textbox being deleted in DayValue 1 is outside the month.

 

See also: other layout tokens.

 


Topic 177515, last updated on 18-Mar-2023