(Okay, this is excessively nerdy talk meant primarily for the InDesign-heads out there. It’s also incomplete. There are a TON of reasons I love GREP styles, but here I’m gonna focus on one.) A few versions back, InDesign added these things called GREP styles, which use the pattern-matching power of regular expressions to cause formatting to happen intelligently and automatically inside of a paragraph style. I used to be a Perl jockey, and that programming language really sings when you get cozy with regular expressions, so when this stuff started showing up in InDesign I was pretty damned happy. With the layout work I’ve done for Hero Games, I’ve used GREP styles to take care of a ton of the formatting that you see in stat-blocks, which is a huge boon. I did similar when doing D&D 4E statblock layout for One Bad Egg. This, however, is not about statblocks. It’s about using GREP styles to perform little tweaks to your header styles. So I’m looking at the Atomic Robo logo. It’s swanky.
And I’m wondering — is there a font that matches this? Clearly there’s some custom type design in the logo, but it’d be nifty if I could put together a header style that did a solid job of matching its look. I do some searching around via things like WhatTheFont, and I come across a pair of fonts that are sort of a match: Melrose Modern One & Two Okay, so Melrose Modern One is a bit closer of a fit, and so I start with that as my header style, getting something like this: Now the hunt for mismatches begins. The A isn’t rounded in One, but it is in Two. The I has serifts on it in One, but is a straight simple line in Two. The M isn’t really a match in either, so I have to set that aside as “it’d be nice, but this will be close enough”. Obviously the lightning bolts are added after the fact, so if I want those, I’ll have to hand-craft them. And the O in Atomic is simply different from the other O’s in the logo — but it looks a lot like the O in Two. I can solve this problem with the addition of two GREP styles (I could probably solve it with one depending on how far I wanted to go, but two will be easier for the teach, here). First, let’s look at the A and the I. I’d like these to be in Melrose Modern Two whenever I type them in the header. Prior to GREP styles, I’d need to find all the instances where I did, and apply a character style that makes them use the Two font instead of One. I’ll start by setting up a character style (“Mel 2”), because that much hasn’t changed. But to apply this effect simply and automatically in my header, I’m going to do this with a GREP style. I edit the paragraph style that I’m using for this header, and I go into the GREP Styles pane of it for the details. I create a new style that applies my character style, Mel 2. For the pattern, I want to do a single-character match for these, and I want it to apply whenever it encounters an A or an I (and as I mess around with it later, when it encounters an R and an N too, so I throw those in for good measure). My pattern is simple:
That’s regular expression speak for “a single character that is either uppercase A, I, N, or R”. What’s the header look like after I make that one change to the paragraph style, without me directly applying any character styles? Much better! And for a workaday header that feels consistent with the logo that inspired it, it’d work pretty much as is. But that O in Atomic hounds me a bit. It’d be fun if every time I typed “ATOMIC”, I got the alternative O from the Melrose Modern 2. I set up another GREP style in my header’s paragraph style, same as the first, but with a different pattern. This one’s a little more complicated — I want it to know that it’s “inside” of the ATOMIC word, but I don’t want it to apply my character style, Mel 2, to the other letters in the word — just the O. So I need it to be able to look to the left and the right of an O, and see if the letters around it spell AT MIC. That’s a concept called “positive lookbehind” and “positive lookahead”, which is a fancy way of saying look and verify, but don’t touch. In regular expression speak, that’s:
Look to the left: is AT there? That’s the first part. Look to the right: is MIC there? That’s the last part. The actually-matched thing, the O, that the character style is applied to, is in the middle. (Important tip: these are case sensitive by default. You’ve got to fiddle with the dials a bit if you want case insensitive.) If I use Mel 2 as my character style, I get this:
Boom! If I really wanted to go nuts on this, I could create a copy of Mel 2 that was maybe 10-15% bigger in size, with a baseline adjustment so the big O would drop down a bit below the other letters on the line, but that probably won’t look as good as I’d want it to because the weight of the O would change as it increased in size. So for now, with the font that I’ve got here, this is my best fit. (If you’ve been paying attention, you’ll see that before all of this I did a font size override on Robo to make it smaller than Atomic, and gave it some different spacing settings, but that’s outside of scope for what I’m demoing here.)
Now, that might seem like a lot of trouble just to do a few letter substitutions in a single logo or header when I could simply apply the character style a few times and be done with it. But as with anything involving regular expressions, the real power comes in when you have to do something a few hundred or more times. With the GREP Style enabled header I’ve made, I can just type FRED DEFINITELY LOVES THOSE ATOMIC GREP STYLES and I get all my A’s, I’s, N’s and R’S substituted out all proper, without having to do anything other than apply the paragraph style to the text — here’s a before and after, without and with the GREP styles involved:
This isn’t always about one font for another font, of course. It’s all in what you do with the character style that you’re applying. Maybe you’re just changing the weight of the same typeface; maybe you’re giving it a different color or a slightly different size; maybe you’re turning on or off certain OpenType features (like swashes) — I did a lot of that last bit with the headers for the Dresden Files RPG, because its header font, Newcomen, has some crazy-great OpenType features, but not always ones that I like consistently turned on or off for every letter or letter combo.
GREP styles are incredibly versatile, and with a few smartly constructed patterns, you can save yourself a lot of work and cause your text to conditionally format itself with a single click.
Can’t recommend them enough.