Re: To Reduce Font Size in Drawing Area
- From: Carlo Agrusti <carlo-ag libero it>
- To: gtk-app-devel-list gnome org
- Subject: Re: To Reduce Font Size in Drawing Area
- Date: Mon, 05 Sep 2005 10:20:27 +0200
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]