is now part of CreativePro.com!

Removing Space Along the Left Edge of Text

34

Here’s another mystery of the deep explained: Why do some characters sit flush against the side of a text frame and others get inset a bit, even when the Text Inset values (inside Object > Text Frame Options) are set to zero?

For example, take a look at these five fonts in a row:

All five are exactly the same size, but some are inset, some are flush, and one sticks out the left side of the frame a bit. What’s the deal? It all has to do with the font’s left side bearing, also sometimes called underhang, overhang, or padding.

When a font is designed, each character is placed on a grid, with the lower-left corner (the origin) at zero,zero. The designer then has to decide how far from that origin the left edge of the character should sit. Here’s an example taken from the Apple web site (my apologies for appropriating it, but it’s for educational usage; and I was afraid that Apple might take that page down sooner or later):

Here’s another page that has some nice font “metrics” graphics I found.

Virtually all characters in all fonts have a little bit of a left side bearing. A few have negative or zero left side bearings and have a bit of a right-side bearing instead. If a font has no sidebearings, then each character would smash into the next in a line of text!

So different fonts have different side bearings for each character. Mystery solved, right?

Well, there are also a couple other factors that come into play. First, the Optical Margin Alignment feature (which you can find by choosing Type > Story) can change the space along the left side of a frame significantly. In some fonts, turning on OMA will cause characters to move in dramatically, adding lots of space where there was previously none. I love the OMA feature, but one must be careful of it, especially in numbered or bulletted paragraphs, where it can cause major alignment problems.

Also, Adobe added a very, very cool feature to its drop caps formatting: If you open the Drop Caps and Nested Styles dialog box (or choose that inside your paragraph styles dialog box), you’ll see a checkbox called called Align Left Edge:

When ALE (I’m in an intialism mood) is on, InDesign removes the left sidebearing of the drop cap entirely, so it becomes flush with the left edge of the frame. Cool!

I figured I could remove the left sidebearing from a one-line paragraph by setting the drop cap Lines to 1, and turning on Align Left Edge. But unfortunately it doesn’t work. I guess InDesign ignores ALE when Lines = 1. Oh well. Maybe in CS9.

In the meantime, there are, of course, tricks to fake InDesign into moving the left edge of a line of text — even moving it right out the left edge of the frame. The basic method is to place a space (or one of the whitespace characters) at the beginning of the line, then placing the cursor between the space and the first character of text, and then kerning backward… a lot!

You can also put the line of text into a table, make sure the cell insets are set to zero, right align the paragraph that the table is on, and make the table wider than the text frame. Did I say it was easy or fun? No. But you can do it!

[Note: See “script alert” in comments below to find a Dave Saunders script that removes the space for you automatically.]

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • Scott says:

    Great description, David… this pokes at my ribs once and a while too. Luckily I have a passion for kerning or it could be upsetting.

    What’s the font you used in the top instance of pear? It’s not a face I recognize. Thanks.

  • Klaus Nordby says:

    Thanks for this put-space-first-then-kern trick, David! It solves this rather annoying problem well enough. It’s a kludge, yes, but they also serve.

  • Lauren says:

    this is something that has puzzled me in the past… and your solution was my solution! but it’s nice to know WHY.
    thanks again as always!

  • Try this:

    1. Type into a new text frame: “Many are the ways.” (without the quotes).
    2. Set the type to be Myriad Pro Black 12 points.
    3. Switch on Optical Margin Alignment for the story.

    Huh? The “M” moves to the right? That I cannot explain. But there’s more:

    4. Open the Drop Caps and Nested Styles dialog and set the line of text to have a two-line, one-character drop-cap.
    5. Activate Align Left Edge.
    6. Close the dialog.

    Now, with the Story panel visible, toggle Optical Margin Alignment on and off and watch what happens to the gap between the “M” and “a” of many.

    However, all this has given me insight into how to write a script to do Align Left Edge for the first character of ordinary paragraphs. I’ll be back.

  • Well, an update before I call it a day: the logic looks right. The math looks right. The results don’t.

    So, maybe tomorrow.

    Dave

  • Jochen Uebel says:

    Hi Dave.
    As soon I am choosing justified alignement ID?s behaviour becomes clear for me:
    1. OMA widens the net space for every line (hyphenation left or right is the proof).
    2. ID is trying to avoid new breaks in this situation.
    3. Therefore all characters have to be pulled a bit to the left and right to fill the space (only those in the center of a line stay where they are). ((Means: OMA is changing the kerning!))
    4. Therefore it is not astounding (for me) that in case of ALE the drop cap is fixed but all the other characters are moving a bit.
    May be my early morning enlightenment (7 a.m. in Germany) could be of help for you and your script: Having such a script would be wonderful. (Having a ALE for one line still more.)
    Jochen

  • Math was right, my foot! There are 12 points in an em set at a size of 12 points, not the 72 I was working with last evening.

    [Editor’s note: If you’re interested in a more detailed analysis of Dave’s script, how he wrote it, and why it works, check out the post he did on his blog. We’ve removed those matters from his comments on this page, to spare non-technical folks the scary details.]]

  • Jeremy says:

    I’m wondering about “baseline” in that diagram borrowed from the Apple site. It looks to me like they’re trying to refer to “character width” or something like that.

  • Yes, Glyph origin should use an angled call-out line to indicate that it is pointing at a specific point and not a line. “Baseline” should be where they have the words “Glyph origin”.

    Dave

  • SCRIPT ALERT: Dave Saunders has graciously allowed us to distribute the cool script he wrote, which removes the space to the left of any first line of text in a paragraph. For example, the first two lines below are “before,” and the last two lines are “after” running the script:

    You can download the (CS3 only) script by clicking on this link to the zip file.

    The script adds a hair space before the line, then figures out the proper kerning to “zero out” the space. Very clever, and a big timesaver!

  • Dave S. also remarked that this version of the script:
    a) works on all paragraphs in a selection
    b) detects that a paragraph has a drop-cap and just makes sure that ALE is on for that paragraph
    c) skips over any paragraph that already starts with a hair space
    d) gives an alert if the attempt to process a paragraph pushes it overset breaking the attempts to read insertion point information (thinks: same thing will happen if the paragraphs start out overset). The user might have to do some repair in this case.

  • Klaus Nordby says:

    Wow, Dave! This works, so we don’t need to twiddle with this manually anymore — thank you!

  • Eugene Tyson says:

    That is just fantastic, not only did he write the script, but explained what each bit did, which is fascinating, I’ve never seen a break down of a script before and what each piece does. It’s fascinating.

    Any chance of making this a blog post of it’s own?

    Good job, Dave!

  • Great script, Dave. But have you noticed what happens when there’s no room at the bottom of the text frame (for instance if you have done a fit frame to content) and try the script on the last line? Ugly error message and we are left with problems…

  • Yep. I warned about that in point d of the comments David published above. I wrote this as a proof of concept and before you know it David wanted a version to publish so I banged out a control loop.

    I’ll try to improve on that. But you can probably fix it by just hitting Undo a small number of times (probably 3 times — once to undo the drop-cap and twice to get the ruler units back to what they were).

    Dave

  • I’ve heard that it’s often true with scripts that it’s about 20% of the work to write the basic script, and 80% of the work to handle all the things that may go wrong with it (putting in error handling, dealing with edge cases, and so on). Especially with a free script, we can’t expect it to work perfectly.

    I find it’s often a good idea to save your documents before running a script; that way you can always use Revert to get back to where you were. Scripts may run dozens or even hundreds of “actions” on your document, and using Undo after that can get tedious (I’ve been there).

  • Harbs says:

    I’d probably put that ratio closer to 5% – 95% !!!

    To write the script may not take more than an hour or two, but to get rid of all those little holes can take weeks. (especially if it’s dealing with a large number of variables/uses…)

  • Stephan Möbius says:

    One more thank you! Thank you so much.

  • Nik says:

    I can’t get my Drop Caps to align to the left margin! Help!

    I am using Myriad Pro Regular for my body and Myriad Pro Bold Condensed for my Drop Cap.

    I have set the Drop Cap to be a 5 lines deep and one character, I have set it to be left aligned in the Drop Cap and Nested Styles menu, it does move over but not enough, it needs to move over about twice the distance.

    I have tried the other methods and Daves script (though I know it’s me and not your awesome scripting handywork Dave!) but to no avail!

    Any and all help much appreciated.

    Regards,

    Nik.

  • Pete says:

    Dave’s script is great, but it seems to work only intermittently in CS5 so I’m back to adding a hair space and kerning.
    Any news on getting around this in CS5 or 5.5?

  • Pete says:

    Scratch that comment … I think the script only failed when I had text that would become overset when the Drop Caps operation was called.

  • Ryan says:

    Okay, I think this question is related to this discussion, so here it goes. I am using some typefaces which not only has a gap on the left, but also on the top. I can get the left side to go away when I need to, but how about the top?

  • @Ryan: If you’re trying to adjust the first line in a text frame, you can probably adjust the First Baseline Offset feature in the Text Frame Options dialog box. For example, if you set it to Ascender, the tops of the font ascenders will be pushed up against the top of the frame.

  • Kristin says:

    Is there any way to remove the right side bearing for all of the lines in a paragraph and not just the first line?

  • Michel says:

    Hi everybody,
    Reading all the comments, and struggling myself with the same problem I found a solution that you may like. The way to do it is to use the drop caps’ align to left, use 2 lines for drop caps and use a large number for characters (like 40) so it covers all your heading lengths. and decrease your intended font size to half.

    I hope my instruction is clear!?

  • Jerrod says:

    Greetings! I know this is somewhat off topic but I was wondering if you knew where I could locate a captcha plugin
    for my comment form? I’m using the same blog platform as yours and I’m hhaving trouble finding one?

    Thanks a lot!

  • Alistair says:

    I found out how to remove this left side bearing of a paragraph..

    See the instruction:
    1. You set the drop cap line of a paragraph to 2.
    2. Check ‘Align Left Edge’.
    3. Create new character style for this drop cap and reduce the character size to the best fitting amount.
    4. Shift the baseline to your liking.
    5. Enjoy!

    Known drawbacks of the hack:
    1.The following paragraph’s first line has an indent.

  • Liss says:

    Hi all, This is sort-of-kind-of a similar problem to what I’m having and haven’t been able to find a solution or thread regarding it.
    Using InDesign CC I have a text box which is not assigned to any paragraph style. There is no text wraps, the text frame options can be on or off, although it usually happens when they’re on. No baseline grid present. The issue is: the right hand side of the text box will not fill properly. You can see that the copy has plenty of room to place a word/letter there before dropping to the next line of the text box, but it won’t fill it to the edge. I don’t want to adjust the size of my text frame and it’s not about justifying text. This bug seems to happen on occasion and can’t put my finger on what is causing it to do it or not!
    Thanks in advance.

  • Liss says:

    Thanks a million David! That was totally it. I didn’t even know that existed! Lifesaver.

  • Sev says:

    This checkbox needs to be a default paragraph option, especially for single line composing.Why isn’t it? gonna submit a ticket to Adobe I think

  • Alex says:

    Great work. Thanks a lot.
    Is there a script available for right aligned by any chance?

    Thanks,

    Alex

  • >