Making a Custom Shape for Highlighting or Boxing Text
T.J. wrote:
Just wondering if it’s possible to get a rounded corner frame behind some text using Paragraph Rules? No, I don’t want to have half circle on both ends, and I don’t want to use paragraph rules from another paragraph above or underneath; nor a one cell table…
T.J. is referring to some solutions I wrote up in this article about Setting Reversed Out Headline Text (White on a Black Bar), and this one one on Putting Headings in Rounded Rectangle Background Frames. The question is how can you put text “inside” some non-rectangular shape, while only using text and text formatting in a story.
Of course, it’s easy to put text in a rounded corner text frame (or a frame of any shape, really), and you can anchor that frame inside another frame:

But this is technically two frames, and TJ wanted a single text story — something that he could flow more or less automatically and format with just text formatting.
So here’s one solution, which takes a little bit of time to set up, but once it’s done, can be applied very quickly: Use a custom font.
In the old days, making a custom font was a hassle and required specialized font software. But since Jongware and Indiscripts teamed up to create IndyFont, we can do it all in InDesign!
The free version of IndyFont can only make one-character fonts, but I’m using IndyFont Pro, which can create multiple glyphs. I won’t go into all the details about how I did this (Scott Citron has a terrific review of IndyFont coming out in the next issue of InDesign Magazine.) But the quick version is:
I used IndyFont to make a font template for me, then created some various shapes for characters. Here’s what I made for the characters four and five (4 and 5):

A couple things to notice here: First, I set the right side bearing guide to the zero point (that’s the green guide you see). This makes the character zero-width — that is, it prints, but all subsequent characters print on top of it! Second, I made these shapes with InDesign’s Corner Options feature. However, it appears that the current version of IndyFont doesn’t support that feature, so I solved the problem by converting the corners to real bezier path points (you can do that by selecting the object and choosing Object > Paths > Close Paths).
Then I used IndyFont to export the font (I exported it directly into the Fonts folder in the InDesign application folder, so InDesign could use it immediately). And I applied it to some text. For example, here is some text in a text frame:

I’m going to apply my new font to that little extra “5” before the yellow text, and I get:

In the above image, you can see the text frame with various type treatments, and the “real” text shown in the Story Editor window. The first line uses a 5, and the next is a 4. The third line is handled differently. In this case, I made new shapes for the 1 and 2 characters of my font:

Then I typed a 1 at the beginning of the line and a 2 at the end, and gave the paragraph a Rule Above that overlapped the text itself. The Rule Above has sharp corners, of course, but the 1 and the 2 in my font stick out beyond the rule, making it a rounded corner.
As I said, it takes some work to set up the font and so on, but once you have it working you can apply the formatting very quickly with paragraph styles mixed with nested or grep styles.
And the great thing is that you don’t have to use rounded corner rectangles… you can use any shape you want! If you can make a frame in the shape of it in InDesign, you can make it a font, and if you can make it a font, you can apply it like this.
This article was last modified on December 30, 2021
This article was first published on August 14, 2013
