4-space tabs in GtkTextView



Hi!

How do I change the default tabs from 8-space to 4-space? I am using the following code:

  // change the widget font to fixed width
  
  PangoFontDescription* font = pango_font_description_from_string (
  
    "Courier, Bitstream Vera Sans Mono, Nimbus Mono L, monospace 12"
  );
  
  gtk_widget_modify_font (GTK_WIDGET (_view), font);
  
  pango_font_description_free (font);
  
  // set the tabs to 4-space
  
  PangoTabArray* tabs = pango_tab_array_new_with_positions (
  
    1, FALSE, PANGO_TAB_LEFT, 12 * PANGO_SCALE // ?
  );
  
  gtk_text_view_set_tabs (_view, tabs);
  
  pango_tab_array_free (tabs);

Basically, I need to find the width in Pango units of a space character from the current font. I thought 
perhaps I could use pango_font_metrics_get_approximate_char_width () or something similar, but I'm not sure 
how to find the PangoFontMetrics from my PangoFontDescription.

I tried searching with Google and in the gtk-app-devel list archives but couldn't find anything.

Thanks in advance!

 - Michael Matthews

-- 
_______________________________________________

Search for businesses by name, location, or phone number.  -Lycos Yellow Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10




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