Re: How to change the default font of a GtkTextView?
- From: Olexiy Avramchenko <olexiy ctech cn ua>
- 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, 09 Dec 2004 15:48:10 +0200
Juha Nieminen 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.
My best guess was this:
pango_font_description_set_family(textView->style->font_desc, "Courier");
However, it doesn't seem to work. How should it be done?
Just use gtk_widget_modify_font() for your textView object. You need to
create a PangoFontDescription object before,
pango_font_description_from_string() is a simple method of doing this.
Dont forget to free the object after use.
(Applying tags to the whole textbuffer is not a good solution because
they don't stay applied to the whole text when the text is edited from
the beginning or the end. Besides, it feels needless when there should
simply be a way of specifying a default font directly.)
Btw, where do I get a list of font family names? I can't find that either
(that "Courier" was a pure guess!).
Use following command 'fc-list | sed -e 's,^\(.*\):.*$,\1,' | sort |
uniq'. fc-list is a tool for quering the fonts avalaible for fontconfig
library.
Olexiy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]