Re: [gtk-list] Freetype and G[TD]K



Please don't cross-post in the future.

You need the gdk pixmap created at the same depth as the gdk window
it is to be drawn into.  Do this:

  gtk_widget_realize(window);
  pmap = gdk_pixmap_create_from_data (window->window,
                                      Small_Bit.bitmap,
                                      Small_Bit.cols,
                                      Small_Bit.rows,
                                      -1,
                                      &white,
                                      &black);

Using -1 in the depth field tells the function to use the value
from the window that is passed in, and if you do not realize the
window first then you are passing in NULL.

Good luck,

-Shawn

On Sun, Aug 15, 1999 at 12:09:36AM +0100, Iain wrote:
> Hi all,
> I'm trying to use Freetype to draw a truetype font into a GtkWindow.
> The way I'm doing it at the moment, is using freetype to render the font
> into a TT_Raster_Map structure, and then using the bitmap field of that
> structure as the data in gdk_pixmap_create_from_data. Then making a
> gtkpixmap and packing that into the window like normal.
> But when I run it, I get a BadMatch error.
> The other way I tried it, was to use gdk_pixmap_new to create a pixmap of
> the required depth, set it as the bitmap field of the TT_Raster_Map
> structure, and then use freetype to render onto it, but that caused a
> segfault inside one of the freetype functions.
> 
> Does anyone have any ideas on how to get it all to work?
> 
> Iain - The code is attached.
> 


--
Shawn T. Amundson               	amundson@eventloop.com	
Research and Development		http://www.eventloop.com/
EventLoop, Inc.				http://www.snorfle.net/

"The assumption that the universe looks the same in every
 direction is clearly not true in reality." - Stephen Hawking



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