Re: Pixel graphics text alignment
On Sun, 04 Jul 1999, you wrote:
> Irv
> What I was thinking is that not paying any attention to what a column
> contains each concatenated piece would be the same size and that
> would align the columns, which might not be the same as sprintf function.
> Bernie
If you concatenate without "padding" the fields, then they will be different
sizes:
adam (4 letters)
jefferson (9 letters)
so the following column won't line up
adam 123
jefferson 123
If instead you use sprintf("%-12s %3d",{name,number})
then you get
adam+8 spaces then the number
jefferson+3 spaces then the number.
That lines things up _if_ you are using a monospaced typeface.
adam 123
jefferson 123
Even this won't line the numbers up if you use a proportional font.
(They don't line up on my e-mail client, for example, because it uses a
proportional font. The two ff's take up less width than the m, for
example).
Irv
|
Not Categorized, Please Help
|
|