Re: gtk drawing area + text



From: "Fabrice Chinjoie" <fabrice chinjoie csiro au>:
What should I do to put a number or a word in a drawing area? It seems
that the gdk_draw_string is deprecated.
Hi!
You should put your text in a PangoLayout. Then draw this layout with
gdk_draw_layout() or gdk_draw_layout_with_colors().

e.g. with something like:
  GdkColor fgColor, bgColor;
  /* initialize colors here */

  PangoLayout *pLayout = gtk_widget_create_pango_layout(pDrawingArea, 0);
  pango_layout_set_text(pLayout, szText, lenText);
  gdk_draw_layout_with_colors(pDrawingArea->window, pGdkGC, x, y,
    pLayout, &fgColor, &bgColor);
  g_object_unref(pLayout);
-- 
Regards,
                     Peter




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