XORing a string

Consider the following function for drawing strings:

static void draw_string (GdkDrawable *dst, GdkGC *gc, int x, int y, 
  char *psz)
  PangoLayout *layout = NULL ;
  PangoContext *context = NULL ;
  PangoFontDescription *fontdesc = NULL ;
  context = 
    gdk_pango_context_get_for_screen (gdk_screen_get_default ()) ;
  fontdesc = pango_font_description_from_string ("Courier 12") ;
  pango_context_set_font_description (context, fontdesc) ;
  layout = pango_layout_new (context) ;
  pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER) ;
  pango_layout_set_text (layout, psz, -1) ;
  gdk_draw_layout (dst, gc, x, y, layout) ;
  pango_font_description_free (fontdesc) ;
  g_object_unref (layout) ;

When I call this function to XOR text onto a drawing area, it simply
copies the text, instead of XORing it.  Thus, if I use this function
twice, the second time around the text I drew the first time around
doesn't disappear.  XORing regular rectangles and lines and arcs and
such works fine.

Can somebody please help me make this function respect the settings
applied to the "gc" parameter passed into it (such as
gdk_gc_set_function (gc, GDK_XOR)) ?

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