Here is a rounded textbox with an inset of 4, vertical align center. I'm turning Auto-Size on, so the right edge grows as the text in the box gets longer.
Width only, adjust only the right edge (that alignment UI is messed up BTW if any Adobe UX peeps read this - I ought to be clicking the right hand edge to get what I want!!).
Now I add an "r" to the end.
Now, instead of the "r" I will add an "a". It's not much wider than the "r", and I'm not doing anything funky with the kerning. This font is also Helvetica Neue LT Std, so a premium tyepface.
Notice how much more padding on the right there is? This makes no sense. Now, if I keep typing...
... the padding appears to remain constant, or grow slightly.
My point here is that the inside padding is messed up. It should be 4px inset all around and that's the end of it. Something's off in your algorithm.
YMMV depending on typeface it appears. Notice that Arial (the second one) appears to work better than Times New Roman.
Yes, I suspected that as well. However, it didn't really make sense - you would expect the taller letters, or the ones with descenders to be the real culprits, forcing the margins out. But look at the "w", which is a wide letter, but not a tall one. That seems to affect the space to the right much more than, say, the "i", which is actually taller.
No, it's set to left justification. I actually don't want it to be centered, because I'm trying to make a button that will have a little "(x)" close box on the right side. Anyway, I wonder, with centering turned on, would we see the left margin float as well?
Peter Spier wrote:
I think it's the size of the leading slug, which doesn't change in height, that makes a difference, not the height of the glyph itself.
Then I guess I don't understand how the margin is different for different letters.
I could be wrong, but I think if you look closely you'll find the same padding after the edge of the right bearing allowance on all of the different glyphs. It might be easier to see if you highlight the text, which will give you a bar that corresponds to the leading slug.