Site icon Colecandoo!

Square Pegs now fit into Round Holes

Advertisements

One hurdle I’ve often encountered with Data Merge is when text fields which have to fit in a given space. Examples may be speech bubbles, headlines or nametags.

Normally, the way to proceed with this variety of project would be to determine the longest word in the database and set the size of the font to fit the longest word. This is fine for large words, but tends to make small words look out of place.

Ideally, it would be nice for the type to fit according to the size of the name, but that isn’t possible… is it? Well, with GREP styles, it is.

This example features a name-badge which contains first names which range between 3 to 11 letters long. The first thing to do is determine how many letters will fit within the given space. To do this, use the widest letter of the font being used (M in this example) and type the letter 3 times until the type fits the box as desired. Now create this as a paragraph style (e.g. Badgetype).

From here, type an additional letter. There will be an overflow warning – this is intentional. From here, use Ctrl-A to select the type and make a new character style called mynameis4. Make sure that the “Apply Style to Selection” checkbox is ticked; and that the “Preview” checkbox is ticked. Within the character style, only edit the Advanced Character Formats and change the items in this panel to distort the type accordingly until the type comes back into view. Once the type comes back into view and appears as desired, click OK.

Now, type another letter and once again an overflow warning will appear. Again, use Ctrl-A to select the type and duplicate the character style to create a new character style called mynameis5. Again, go to the Advanced Character Formats and again distort the type until it appears as desired. Click OK.

Repeat this process until all 11 letters have character styles assigned to them. Apart from [None], there should be 8 character styles from mynameis4 to mynameis11. From here, select all the type again and select the character style [None] to remove the style. The type will overflow once again, but this edit the Badgetype Paragraph style.

From this dialog box, go to the GREP styles options and make a new GREP style. From here, select the mynameis4 Character style; and in the GREP search below, type:

….

(four fullstops)

make another GREP style and select the mynameis5 Character style; and in the GREP search below, type:

…..

(five fullstops)

Repeat this process until all remaining styles have GREP styles associated with them. That is, a seven letter style will have seven fullstops in the GREP search. The only exception is “mynameis11” which will have a “+” after the last fullstop. Click OK once this is done – the GREP styles dialog portion of the dialog box should look like the screengrab below.

If this is done correctly, the type should change size whenever a letter is added so that the type becomes incrementally smaller as type is entered.

To make this work with variable data, simply select the database and then insert the textfield and apply the paragraph style Badgetype to it.

Voila! I have included the PDF used for this tutorial which contains attachments of the InDesign and database files so that people can see exactly how this was constructed.

Exit mobile version