Around 16 o'clock on Nov 14, Ted Roden wrote:

> Here is the font drawing stuff. 

Well, I took your example and created a complete application and it works 
just fine.

#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>

main (int argc, char **argv)
{
    XftFont *font;
    XftDraw *draw;
    XRenderColor render_color;
    XftColor xft_color;
    char *str = "Test String";
    int x = 10;
    int y = 20;
    Display *dis = XOpenDisplay (0);
    int screen = DefaultScreen (dis);
    Window  w = XCreateSimpleWindow (dis, RootWindow (dis, screen),
                                     0, 0, 100, 100, 1,
                                     BlackPixel (dis, screen),
                                     WhitePixel (dis, screen));
    XEvent ev;

    render_color.red = 189 * 257;
    render_color.green = 182 * 257;
    render_color.blue = 107 * 257;
    render_color.alpha = 65535;

    XftColorAllocValue (dis,
                        DefaultVisual(dis, screen),
                        DefaultColormap(dis, screen),
                        &render_color,
                        &xft_color);

    font = XftFontOpen(dis, screen,
                       XFT_FAMILY, XftTypeString, "charter",
                       XFT_SIZE, XftTypeDouble, 12.0,
                       0);

    draw = XftDrawCreate(dis, w,
                         DefaultVisual(dis, screen),
                         DefaultColormap(dis, screen));

    XSelectInput (dis, w, ExposureMask);
    XMapWindow (dis, w);
    for (;;)
    {
        XNextEvent (dis, &ev);
        if (ev.type == Expose)
            XftDrawString8(draw, &xft_color, font, x, y, (XftChar8 *) str,
                           strlen(str));
    }
}


_______________________________________________
Render mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/render

Reply via email to