XDrawString - Motif

This is a discussion on XDrawString - Motif ; Hi, 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[0]].lbearing; XDrawString(display, window, ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: XDrawString

  1. XDrawString

    Hi,

    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[0]].lbearing;

    XDrawString(display, window, gc, -x, y, string, strlen(string));

  2. Re: XDrawString


    Russell Shaw escreveu:

    > Hi,
    >
    > To draw strings aligned with a left margin, should i use x=0:
    >
    > char *string;
    > ...
    > XDrawString(display, window, gc, 0, y, string, strlen(string));


    Short answer: yes.

    Long answer:
    I suppose you use Motif, since you posted to comp.windows.x.motif. In
    this case you may create a XmString and take advantage of more flexible
    XmStringDraw, that allows you to use the "alignment" "and
    layout_direction"
    arguments.

    --- Casantos


+ Reply to Thread