rjshaw at netspace.net.au
Fri Dec 16 05:06:55 PST 2005
Glynn Clements wrote:
> Russell Shaw wrote:
>>To draw strings aligned with a left margin, should i use x=0:
>> char *string;
>> XDrawString(display, window, gc, 0, y, string, strlen(string));
>>or am i supposed to use lbearing? :
>> XFontStruct *font;
>> int x = font->per_char[(int)str].lbearing;
>> XDrawString(display, window, gc, -x, y, string, strlen(string));
> For most practical purposes, you should be using x=0. That will result
> in lbearing blank pixel columns before the first drawn pixel. I can't
> think of a practical situation where you might want to use -lbearing.
> Apart from anything else, using x=0 is necessary for lines of text
> using a monospaced font to align.
I wasn't sure if the lbearing of all chars is the same. If lbearing was
the same for all chars, then why have it? If it wasn't the same, then
text wouldn't align on the left margin. Hmm, maybe the lbearing space
is for the cursor?
More information about the xorg