How to Insert Icons in CCG Card Text with InDesign GREP [Tutorial]


One of the trickiest aspects of doing production design in tabletop games is figuring out how to automate tons of variable text across a set of cards or tiles. (Good thing I have a handy video tutorial course on just that subject.) But the really advanced next step of that process is figuring out how to insert icons at any point in a body of text without relying on linked image files. This is a challenge most commonly seen in CCGs but quite present in any number of other games, too.

I asked my tweeps for some advice on how to do this with InDesign GREP without having to learn any fancy coding. I've always been of the curmudgeonly opinion that there ought to be an option for graphic designer that doesn't require them to be a programmer, too. Perhaps I'm a Luddite in that respect, but fortunately I'm not alone in that sentiment. Andy Lenox sent me this list of GREP tricks, the last two of which were the real key I was looking for.

Now this might be a very roundabout way to do things, but it's working very well for me so I'm sticking with it for now. If you have a faster way to do this, feel free to share in the comments.


Overview

Your plain text is going to be peppered with shortcut letter and number combinations that represent specific icons you want to insert in their place. Those icons are actually characters from a separate font that you have either purchased or made yourself.

For example, this card...

will end up with text like this...


Basically, you're going to make character styles for each of your icons and another character style that makes the number "disappear." Here's how...


Choose your Shortcut System

To keep all your icon codes straight, it can be handy to make a list that you use as a reference sheet. This is especially necessary if your working on a team. In my case, my font is Webdings and the "icons" I'm using are the characters N d i q e. When you use a custom font, you can control which characters are mapped to which icon, to make this part much easier.

I'm going to pair each of those special characters with the numeral "1" since it won't occur naturally at any other point in my game. So for example N1 will stand in for the "eye" icon.


Create your Character Styles

First, make a new character style called Disappear. This style will have the smallest horizontal scaling and point size possible, and have its color set to none. Visually, any text with this style will shrink to effective non-existence, though it will still be there if you do any manual selection of the text.




Then set up a character style for each of your icons. I actually like to create one "parent" style for my icons first, then make "child" styles based on that style. In this way, I can just edit the "parent" style if I want to make global changes to all the icons as a whole. In any case, you'll end up with a character style like this, with your chosen font and your chosen color.




Create your GREP Paragraph Style

Now you can set up your paragraph style for your CCG body text. I prefer to make this body text its own paragraph style so my edits here don't affect card titles, stats, or any other text on the card. Feel free to set up the text's attributes however you wish, with whatever font, leading, color, etc you prefer. The bit we're concerned about right now is under GREP Styles.

For each icon, make a new GREP style as shown below. For example

N(?=1) 

tells InDesign to look for the character N, but only if it is followed by the number 1. Any other instances of N are ignored. To that character, I apply the Character Style Icons - Eye. You can call your styles whatever you want, but I like to be as literal as possible. In this case, the character N in Webdings looks like an eye, so it made sense to label it as such.

As you make each GREP style, if you have "preview" checked, you'll see your work in progress! Like magic, those characters will be replaced with colorful icons.


But wait, now you have all these random 1s floating around the text. How to get rid of them? With your Disappear character style! Because this style will be applied to each indiscriminately, I can use the following string in this grep style:

(?<=N)1|(?<=d)1|(?<=i)1|(?<=e)1|(?<=q)1

This tells InDesign to look for any instances of 1, but only if preceded by the characters N d i q e, then apply the Disappear style to each. When you're done, it should look like this.*



There! Now you have handy icons sprinkled into your regular text without having to manually insert any external image files. Don't forget to check out my Card Design for Tabletop Games video course that teaches you how to make a whole deck of cards and tiles in a snap!

*Update: 11/7/2014: Check Mark Sherry's comments below for a shorter version of this expression that can also work. (?<=(N|d|i|e|q))1
Daniel Solis
Art Director by Day. Game Designer by Night.