Hello,
  could you help me, please. I wrote X aplication which draw text into
window. How could I draw text with different font size? I`m able only
use fonts which are in font.aliases. And I want to draw text with size
50, 54, 60,...


// this way I do it now.
// init font
font1 = XLoadQueryFont(display,"*-helvetica-*-12-*"); 
font2 = XLoadQueryFont(display,"*-helvetica-*-18-*"); 
font3 = XLoadQueryFont(display,"*-helvetica-*-24-*"); 

// draw text 
void Win::DrawText(int x, int y, char *text, char *col, int fnt)
{
        XFontStruct *ft;

        if (fnt==FONT_SMALL) ft = font1; else
        if (fnt==FONT_MEDIUM) ft = font2; else ft = font3;

        XSetForeground(display, gc, get_color(col));

        XSetFont(display, gc, ft->fid);
        XDrawString(display, buffer, gc, x, y+ft->ascent, text, strlen(text));
} 

Regards,

Tomas


Reply via email to