I am writing a C application in Ubuntu using gtk+2.0.
I have a textview to disply chat messages. Every message comes below the time it’s sent.
What I want to do is use different font style(e.g. color) to display them.
I find these font chooser and color chooser but I haven’t found how to use them yet.
Can someone give me some advice, or better, examples?
The text shown in a text view is represented by a
GtkTextBuffer. To change the appearance of one segment of the text buffer, you create aGtkTextTag, for example usinggtk_text_buffer_create_tag(), set the font and colors as you like and apply the tag withgtk_text_buffer_apply_tag()on a range of the text buffer identified by start and end iterators.It may be worth to have a look at the Gtk+ manual, which has a section that describes how the different components work together.