Re: How to change the default font of a GtkTextView?

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

 



On Thu, 9 Dec 2004 15:24:24 +0200 (EET), Juha Nieminen <warp@xxxxxxxxx> wrote:
>   One would think changing the default font of a newly-created GtkTextView
> would be a piece of cake, but I simply can't find any way of doing that.
> There doesn't seem to be any function which would do that directly in
> either GtkTextView nor in any base classes.       

Try:

  text = gtk_text_view_new();
  font_desc = pango_font_description_from_string( "Mono" );
  gtk_widget_modify_font( text, font_desc );
  pango_font_description_free( font_desc );

There's a longer example on the textwidget overview:

  http://developer.gnome.org/doc/API/2.0/gtk/TextWidget.html

>   Btw, where do I get a list of font family names? I can't find that either
> (that "Courier" was a pure guess!).

fc-list shows all the fonts that pango knows about. In addition, there
are the aliases 'Sans', 'Serif' and 'Mono' which give you the 'best'
fonts in each category.

John
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux