freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] Help with displaying FT_Bitmap!


From: Charles Doutriaux
Subject: [ft] Help with displaying FT_Bitmap!
Date: Tue, 01 May 2007 10:37:50 -0700
User-agent: Thunderbird 1.5.0.10 (X11/20070221)

Hi,

I'm new to truetype and I'm trying to display Font on an X11 window.

I've been fighting with tihs for a while now and I hope somebody on this list can help me.

Following the tutorials i'm able to load a font and get the Bitmap, now i'm trying to have it dispalyed on my X11 wondow,

I'm doing the folowwing cals (one per character)
 bitmap=face->glyph->bitmap;
connect_id.display is my X11 display
visual my X11 visual
 /* convert to an anti-aliased bitmap */
 error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL );
 printf("rendered the glyph\n");


 /* Shortcut */
 bitmap=face->glyph->bitmap;
 /* X-window attributes init */
 dpy = ws->dpy;
 win = ws->win;
 gc = ws->textgc;

 /* Get info about Display */
 printf("Getting geometry thingy\n");
XGetGeometry(connect_id.display,connect_id.drawable,&root_return,&x,&y,&ww,&wh,&wbw,&wdepth);
 /* Create the XImage */
ximage = XCreateImage(connect_id.display,visual,wdpeth,ZPixmap,0,bitmap.buffer,w,h,16,0);
   printf("created image,xloc,ylox: %i,%i\n",xloc,yloc);

 /* And now put it on screen */
XPutImage(connect_id.display,connect_id.drawable,gc,ximage,0,0,xloc,yloc,w,h);

All i get are little black squares which seem to have the right dimension for the bitmap.
my display depth is 16bit
the bitmap"pitch" is 8
the bitmap "pixel" is 2

i'm suspecting part of my problem is that I need to convert the FT_Bitmap to some 16bit... Any idea on how to do that? I looked into the ft2demo... Seems like there's a lot of blitter and all involved, anybody can point me to some documentation on how to do this blit/conversion ?

Thanks,

Charles.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]