Re: How to change the default font of a GtkTextView?
- From: John Cupitt <jcupitt gmail com>
- To: Juha Nieminen <warp cs tut fi>
- Cc: gtk-list gnome org
- Subject: Re: How to change the default font of a GtkTextView?
- Date: Thu, 9 Dec 2004 14:50:24 +0000
On Thu, 9 Dec 2004 15:24:24 +0200 (EET), Juha Nieminen <warp cs tut fi> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]