Re: 4-space tabs in GtkTextView



Hi Michael,

On 10/21/05, Michael Matthews <michael-a-matthews lycos com> wrote:
How do I change the default tabs from 8-space to 4-space?

I use the following:

static PangoTabArray *
program_tabs_new( void )
{
        const int ntabs = 20;
        const int tab_width = 15;       /* in pixels */

        PangoTabArray *tabs = pango_tab_array_new( ntabs, TRUE );
        int i;

        for( i = 0; i < ntabs; i++ )
                pango_tab_array_set_tab( tabs,
                        i, PANGO_TAB_LEFT, i * tab_width );

        return( tabs );
}

then later:

        program->text = gtk_text_view_new();
        font_desc = pango_font_description_from_string( "Mono" );
        gtk_widget_modify_font( program->text, font_desc );
        pango_font_description_free( font_desc );
        tabs = program_tabs_new();
        gtk_text_view_set_tabs( GTK_TEXT_VIEW( program->text ), tabs );
        pango_tab_array_free( tabs );

John



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