I am writing this for others who might be interested in my solution, and also as a memo to my future self.
The goal is to design a box with two or more sections of text, in which each section autoresizes vertically to fit the text, and surrounded by a border with rounded corners. The former can be easily accomplished with tables (so, it requires OG Pro), but it took me a while to figure out the trick to combine it with the latter. Besides, we want everything to stay perfectly aligned with a grid. So, the result will look like this:
Ready? Here is how to do it, step by step:
Set up the grid in the Canvas Inspector: set points as the Ruler Units, set Major Grid Spacing to 8pt and Minor Grid Steps to 2. Check Snap to grid and Show grid lines. The spacing for the grid is inferred from the height of the font we are going to use (Courier). See below.
Draw a 96x12pt rectangle (check the size in the Object Inspector). Choose Arrange > Make Table (OG Pro only!).
Drag the table’s bottom handle to create three vertically aligned cells. It should look like this:
- In the left sidebar, expand the table, rename the three rectangles TItle, Top Section, Bottom Section, respectively, select the Title rectangle, and set the following properties: No Fill; No Stroke; Helvetica Neue at 9 pt; left aligned text, allow text to overflow shape, don’t wrap to shape; 0pt left/right margin, 0pt top/bottom margin. Give the cell a title and set its height to 12pt:
- Select the Top Section and Bottom Section rectangles, and set the following properties: No Fill; No Stroke; Courier at 7 pt; 0 pt line spacing; left aligned text, text flow, wrap to shape, 3pt left/right margin, 1pt top/bottom margin. Type something in each cell. Verify that the whole table has size 96x32pt. If the vertical size of the table is not a multiple of the grid size, tweak the height of the title cell to fix it (it should be 12pt, as per above):
Note that the Top Section and the Bottom Section are 10pt tall; but if you add more lines, each line extends its cell by 8pt. That is why the grid’s size was chosen to be 8pt. So, the table’s vertical size will always be a multiple of 8pt (provided that each section contains at least one line of text). For the following, make sure that there is exactly one line of text in the Top Section and one line of text in the Bottom Section (so, the two sections should be 20 pt tall—plus 12pt for the title equals 32pt overall height).
- Draw a 96x20pt rectangle and set the following properties: white solid fill, black single stroke, rectangle shape, 4pt corner radius. Put it to the background (Arrange > Send to Back) and drag it under the table, to fit the text of the Top and Bottom Section:
- Now for the magic trick: in the sidebar, drag the rectangle into the table, under the Bottom Section. Now, when you edit the Top or Bottom section, the rounded rectangle should automagically adapt.
- As a final touch, add a line separator: choose the Top or the Bottom section, and add four magnets at the corners. Then, select the Line tool and draw a separator line joining two magnets:
Remove the other two magnets if you want. That’s it!
If you want to design a similar stencil with your own fonts, I’d recommend that you start by building a table and checking first of all the line height of the font you want to use, and how it affects the table’s height, possibly with some top/bottom margin. With a bit of trial and error, you should understand what the optimal grid size should be. Having a title cell (whose height can be set explicitly) gives some leeway to compensate for the height not being a multiple of the grid size in some cases (in the above example, a one line cell was 10pt tall, because we have added a 1pt top/bottom margin, but each subsequent line extended the height of the cell by 8pt, not 10pt, giving cells of height 10pt, 18pt, 26pt, etc.).