Freetype Glyph bitmap -> Gtk Pixmap (colored)



Hi,

I'm using Freetype to create text with the following code segment

FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
FT_Render_Glyph(slot, ft_render_mode_normal);
.....        
gdk_draw_gray_image(widget->window, gc, x, y,
    slot->bitmap.width, slot->bitmap.rows,
     GDK_RGB_DITHER_NORMAL,
     slot->bitmap.buffer,
     slot->bitmap.pitch);

This works fine, and produces white text on a black background. I want
to be able to change the text and background color. I've tried
allocating my own color map and using:

gdk_draw_indexed_image(widget->window, gc, x, y,
    slot->bitmap.width, slot->bitmap.rows,
    GDK_RGB_DITHER_NORMAL,
    slot->bitmap.buffer,
    slot->bitmap.pitch,
    &cmap);

This sort of works, but the grayscale mapping of the glyph bitmap is
obviously being mapped incorrectly to my color map, as the text is not
quite right.

Does anyone know how I can change the colors of the glyph bitmap ?

(I'm using Freetype, rather than Pango because I can do

FT_Set_Pixel_Sizes(
   face,// handle to face object
   i,      // pixel_width
   j);     // pixel_height

and create a font with tall skinny character for example).

Thanks,

Bryan




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