Re: To Reduce Font Size in Drawing Area



sadhees kumar ha scritto lo scorso 05/09/2005 09:30:
Dear Friends,
Iam developing a screen using gtk+, i have a drawing area in my screen in which i draw graphs and strings. The problem im facing now is that i could not reduce the font size in the drawing area. I define the font using gtk_font_load( ); function. It would be of great help if anybody let me know this.

You could use pango layouts for this:

  GtkWidget*            draw;
  GdkGC*                gc;
  GdkColor*             red;
  PangoLayout*          pl;
  PangoFontDescription* lblfont;
  gchar*                label;

  ...

  gc = gdk_gc_new (draw->window);

  pl = gtk_widget_create_pango_layout (draw, " ");
  lblfont = pango_font_description_from_string ("Sans 8");
  pango_layout_set_font_description (pl, lblfont);

  label  = g_strdup ("put your text here");
  pango_layout_set_text (pl, label, -1);
  g_free (label);
  gdk_draw_layout_with_colors (draw->window, gc, pos_x, pos_y,
                               pl, red, NULL);




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