August 23, 2006

ASK MORDY: Text Alignment Nuances

Those who have used Illustrator prior to version CS know that it was once possible to use the Average command to align point text. Alas, those days are gone with the way the newer text engine works, and instead, one can use the Align palette (or the Align icons that appear in the Control Palette when multiple objects are selected) to align text objects. In some ways, the align options are far more powerful now because of this.

To illustrate, take this wonderful question that comes in from Greg Walker:

So, let’s say you’ve a line of text that you want to align horizontally to the center of a circle. If it has ascenders and descenders, then when you align the two they look great (nicely centered). However, if you’ve got something typed in all caps or small caps it starts to look funny because Illustrator (and InDesign for that matter) is still taking into account the space assigned for ascenders and descenders. Your alignment looks slightly off. You can convert the text to outlines and align it just fine, but is there a way to get around having to do that? You can kern optically, but can you align optically?

Greg is absolutely right here. When Illustrator aligns a text object to another shape, it's taking the height of the characters -- which includes ascenders and descenders -- and centering the objects based on that. If indeed, your text contains characters that touch these two extremes, your text will look as though it is centered with the other object, as illustrated below:



The problem arises when you don't have both ascenders and descenders in your type object. In the example shown below, I've changed all the characters to all caps. Now, when I try aligning the cricle and the text, it appears as if the text isn't aligned. It is, from a theoretical standpoint, but us designers don't get paid money to make graphics that is "theoretically correct" -- they need to be visually correct.



So how to get around this issue? I'll admit my first thought was to run to the Align palette, and from its palette menu, choose the "Use Preview Bounds" setting. My hope was that Illustrator would use the visual appearance of the text to make the alignment, the same way it does with vector objects. Alas, it was not to be. Illustrator must use a different algorithm when it comes to aligning text objects.

And then I took a clue from Greg's original question -- where he specified that converting the text to outlines would result in the effect he was looking for. And that was just the clue I needed. Maybe if we "fool" the Align palette into thinking that the text has been outlined, it will align the text correctly? And you know what? IT WORKED.

Here's what to do:

1. First, you'll need to go to your Align palette, and you'll need to turn Use Preview Bounds on. You'll only have to do this once as the setting will stay on until you turn it off.

2. Select your text and choose Effect > Path > Outline Object. If you've never used this Effect before, it converts your object (whatever it may be) into outlines -- but as a live effect. The text of course, it still completely editable.

3. Align the text as you did before, selecting the circle and the text. The result, since the Align palette "sees" the outlined text, and since it has Use Preview Bounds turned on, will center the text based on its visual appearance, not based on the heights of the ascenders and descenders.



If this is something you do alot, you can simply set up a Graphic Style that adds the Outline Object effect. So you'd select your text, apply the style, Align the objects, then clear the style from the text. In this way, the text always remains editable, and you get the effect you're looking for.

11 comments:

Anonymous said...

Hey.. Great tips again. Thanks!
Keep them coming... ;-)

Anonymous said...

It might be worth noting that the reason Adobe uses the full text layout box for alignment instead of the box that bounds the text outlines is that by far the most common use of horizontal text alignment is to align multiple point text objects to each other, such as rows of column labels, and in those situations, while one text object may not have any descenders (or with lowercase, may have no ascenders), it may be getting aligned to another text object that does have those elements. And in that situation one nearly always wants their baselines to be aligned, not the bounding boxes of their outlines.

Unknown said...

That makes perfect sense Teri. But I also know that Illustrator, being a graphics app, is called upon to align text with graphics all the time as well. I would propose that the "Use Preview Bounds" should use the text outline boundaries, the same way it does to other graphic objects. Or, possibly even add an additional setting just for text (Use Text Preview Bounds)

Unknown said...

In Illustrator CS5, is there any parallel to InDesign's ability to change a path mistakenly clicked on with the type on a path tool and thus given the type on a path attribute, to UNASSIGNED or GRAPHIC?

Unknown said...

In Illustrator CS5, is there any parallel to InDesign's ability to change a path mistakenly clicked on with the type on a path tool and thus given the type on a path attribute, to UNASSIGNED or GRAPHIC?

Anonymous said...

note that when Use Preview Bounds is turned on you cant distribute between guides :/ any suggestions?

Anonymous said...

thank you so much. it works great!)

Travis said...

Awesome, exactly what I have been wanting. I often need to align text inside of a colored rectangle, and finally I can do this with ease!

Catherine Janosky said...

Wow! You nailed it on aligning text! So easy! Thank you so much! I've looked at so many other instructions that didn't work or were too complicated. This worked!

Unknown said...

thank you for that tip! i was about to switch to photoshop again to build my web layout... some how the whole snapping and aligning in illustrator is a big mess, but I'm a step further now. thanks :)

Anonymous said...

B-E-A-UTIFUL! This trick will save me a ton of time aligning stuff in Illustrator. Thanks!