Jump to content

 
Photo

Illustrator labels - background polygon alignment

- - - - -

  • Please log in to reply
8 replies to this topic

#1
jamierob

jamierob

    Contributor

  • Validated Member
  • PipPip
  • 19 posts
  • Gender:Male
  • Location:Missoula, MT
  • United States

Hi all- I'm having an issue with aligning background rectangles that are applied to text layers in Illustrator.

I'm using the method of adding background polygons to text layers by adding a stroke and fill to text via the Appearance palette, and then applying the 'convert to shape>rectangle' effect via the effects menu to the stroke and fill.

It works great, except for the fact that there is a space below the text that is controlled by the text itself. (if you were to underline the text, this space is filled.)

The workaround I've been using is to duplicate the text layer, convert the text to outlines (Type>Create Outlines), and then apply the fill and strokes with the 'rectangle' effect to that layer. This provides the correct padding around the text, but then the rectangles are not linked to the text and will not expand/contract when you edit the text.

So, is there any way to make the text get rid of the space below the text so that background rectangles applied to it will have the correct padding? Is this font specific? I messed around with all of the options in the character palette and tried multiple fonts and can't seem to find a fix there.

Screenshot - text with background rectangle - notice space below
Attached File  labelbg_text.jpg   64.64KB   68 downloads

Screenshot - text layer duplicated, outlines created (different text/polygon layers)
Attached File  labelbg_outlined.jpg   56.97KB   46 downloads

Thanks!

-jamierob

#2
Adam Wilbert

Adam Wilbert

    Legendary Contributor

  • Validated Member
  • PipPipPipPipPip
  • 274 posts
  • Gender:Male
  • Location:Bellingham, WA, USA
  • United States

It's going to be font specific. Illustrator is using the height of the entire typeface, from the lowest decender (like the stem on 'p') to the tallest ascender ('b') to calculate the size of the rectangle transformation. Since your example is only using tabular figures (vs. Old Style), there are no decenders and thats why the padding looks off. You could apply a "transform" effect to your rectangle to shift it back up relative to the text, but you would need to find the distance that your font's decenders extend below the baseline. And then you would need to adjust the "extra height" added to the rectangle transformation to be less than the "extra width". But that fix would only work for that specific typeface, at that specific point size, and only for text strings that don't include any decenders.

Adam Wilbert
CartoGaia.com & AdamWilbert.com
Lynda.com author of "Up and Running with ArcGIS"


#3
jamierob

jamierob

    Contributor

  • Validated Member
  • PipPip
  • 19 posts
  • Gender:Male
  • Location:Missoula, MT
  • United States

Thanks for the info Adam, I'll give the transform a shot. The duplicate layer/convert text to outlines method might be the cleanest way to handle this i think. I'll just have to wait till everything is perfectly set and create the rectangles when i know i won't be moving the labels again.

-Jamie Robertson

#4
rudy

rudy

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 739 posts
  • Gender:Male
  • Location:Canada
  • Canada

Gee - who knew you could do boxed labels like this? I've been using Illustrator for years and am still learning new things! Thanks for the tip.

#5
Adam Wilbert

Adam Wilbert

    Legendary Contributor

  • Validated Member
  • PipPipPipPipPip
  • 274 posts
  • Gender:Male
  • Location:Bellingham, WA, USA
  • United States

Okay, so this post got me thinking that there had to be a better way, so I played around when I got home. You're going to like this! :)

On your live type, you've applied a new fill and placed it below your "characters" in the appearance panel.
Then you've applied a rectangle transformation to that fill (Effect > Convert to Shape > Rectangle) Set your desired padding relative to the type. (ie, Extra Width: 6pt. Extra Height: 6pt.) So far so good.
The magic step is to also apply another effect. Effect > Path > Offset Path. Set the value to zero and make sure that it is above the rectangle effect. This will reset the outline bounding box tight to your characters, and then the rectangle transformation will expand from there. All while keeping the type live and editable!

I do get some weird alignment issues with certain fonts when applying a stroke and a fill using this method. For instance capital A and W in Helvetica cause a gap to appear between the stroke and the fill, but numbers do not. Not sure why that would be.

Adam Wilbert
CartoGaia.com & AdamWilbert.com
Lynda.com author of "Up and Running with ArcGIS"


#6
natcase

natcase

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 572 posts
  • Gender:Male
  • Location:Minneapolis, Minnesota
  • Interests:cartography
    aeshetics
    cartographic design
    John Bartholomew
    road maps
    large-scale mapping
  • United States

You can also do things to the position of the type within a box by using baseline offset within the character palette (which can be made into part of a character style), and/or using "inset spacing" under "offset" in the "area type options" palette. I don't think this can be set as a style.

I still tend to use separate objects. The problem I run into most commonly is type moving around relative to the box when I do a transform-separately fix when rescaling... but some of this may be because so many of my files are legacy translations from FreeHand.

Nat Case
INCase, LLC

Minneapolis, Minnesota USA
maphead.blogspot.com



#7
Adam Wilbert

Adam Wilbert

    Legendary Contributor

  • Validated Member
  • PipPipPipPipPip
  • 274 posts
  • Gender:Male
  • Location:Bellingham, WA, USA
  • United States

Nat,

You can lock in to scale attributes, but it's not in an obvious place. If you're free-scaling with the Selection Tool (V), the default is to NOT scale strokes and effects. If you scale with the Scale Tool (S) then there is an option to "Scale Strokes and Effects". The weird thing is is that this checkbox option also affects the Selection Tool operations. It will also change the behavior of Object > Transform > Transform Each... when scaling a group of objects around their own center point. But it doesn't seem to affect the way that the "Transform..." Effect works, unfortunately.

So here's the fix that I set up early in each file I work on: Double click on the Scale Tool to bring up the options. Check the "Scale Strokes and Effects" option, and set a Uniform Scale to 100%. This will set the option without altering any selected artwork, and also set it for the Selection Tool. Now when you use the Selection Tool to shift-drag artwork to a new size, or use "Object > Transform > Transform Each..." , the strokes and effects will follow along proportionally! (This works in CS5, I can't be sure it's the same behavior in other versions though).

-Adam

Adam Wilbert
CartoGaia.com & AdamWilbert.com
Lynda.com author of "Up and Running with ArcGIS"


#8
natcase

natcase

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 572 posts
  • Gender:Male
  • Location:Minneapolis, Minnesota
  • Interests:cartography
    aeshetics
    cartographic design
    John Bartholomew
    road maps
    large-scale mapping
  • United States

Nat,

You can lock in to scale attributes, but it's not in an obvious place. If you're free-scaling with the Selection Tool (V), the default is to NOT scale strokes and effects. If you scale with the Scale Tool (S) then there is an option to "Scale Strokes and Effects". The weird thing is is that this checkbox option also affects the Selection Tool operations.


Yep, I use this all the time—my problem is if I have a shield made of multiple elements, especially if the entire shield-plus-type thing is not a single group (for whatever reason... output from Arc is a common suspect, or oddly made shields from old Freehand files), and I select "transform each" for a layer, they don't all end up lined up the way they were when they were smaller. Not entirely sure why this is, but a couple common things might hurt:

- type in a shield not being center-aligned
- type that has its font slightly adjusted (Helvetica to Helvetica Neue; different versions of Avenir)
- type going from type engine to type engine: Freehand to AI CS3 to AI CS4... or ESRI to AI. I have a lot of old files, some of them originally 15+ years old, which have been round the block enough times it would be a miracle if they didn't start to look a little creaky after a while.
- the fact that transform engines aren't always PERFECTLY precise, and enough incremental rounding errors will eventually nudge things that required .5 point tolerances to look right, visibly out of sync.

Nat Case
INCase, LLC

Minneapolis, Minnesota USA
maphead.blogspot.com



#9
d_say

d_say

    Newbie

  • Validated Member
  • Pip
  • 7 posts
  • Australia

One thing that i have found as a bit of a work around is that once you have drawn your rectangle draw a horizontal straight line that passes through the rectangle directly in the centre. the grab your text tool and create text along a path on the line you just created. set your font and size and then within Type > Type on a Path > Type on a Path options select the 'Align to path' option to be "Center"

remember that when you create text on a line/path the linear feature looses all attributes and becomes a 'hidden' line so you wont see it :)

so once you have set the align to path to be center you then need to set you start and finish handles for the type on a path to be at each side of the rectangle. Also make sure that the text is aligned to the center and you will find that your text is placed directly in the middle of your rectangle :)

hope that helps, sorry i couldnt write up a more in depth 'tutorial' sytle guide (just got to work and need to finish off a large format map)

let me know how you go and if you need any other help

Cheers,
Dean




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->