Size of text


I'm developping an application with Gtk+ 2.0, and I'm fighting with
Pango (mostly due to the lack of a tutorial or basic help other than

I want to draw text on a pixmap, and I'd like to be able to scale it by
a given factor. I tried pango_attr_size_new, but can't make it work. I
would expect the following code:

button_press_event (GtkWidget * widget, GdkEventButton * event)
  PangoLayout *p_layout;
  PangoAttribute *p_attr;
  PangoAttrList *p_list;

  p_layout = gtk_widget_create_pango_layout (widget, "Text");
  p_list = pango_attr_list_new ();
  p_attr = pango_attr_size_new ((int) (10000 * (1 + ((double) i) / 5)));
  printf ("%d\n", (int) (10000 * (1 + ((double) i) / 5)));
  pango_attr_list_insert (p_list, p_attr);
  pango_layout_set_attributes (p_layout, p_list);

  gdk_draw_layout (widget->window, widget->style->black_gc, 60 * i + 10,
                   10, p_layout);

  return TRUE;

to display "Text" every time I click, with its size increasing, but the
size is always the same (the default size), though the (int) (10000 * (1
+ ((double) i) / 5)) factor is increasing.

I think I miss something trivial, but can't figure out what. Can someone
help me?


François-Xavier Coudert
École normale supérieure
45, rue d'Ulm - 75005 Paris
<Francois-Xavier Coudert ens fr>

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