[Gtk-sharp-list] Pango color

Michael Hutchinson m.j.hutchinson at gmail.com
Sun Dec 20 14:16:31 EST 2009

On Wed, Dec 16, 2009 at 8:09 AM, farolfo <farolfo at hotmail.com> wrote:
> How I can set the color of the font when I render it with Pango ?
> I use SetMarkup but if I pass a string to the function with the escape
> charater (like & or >) pango dont render text and sometimes I recive a c++
> runtime error from the system.

If you want to use Pango Markup, you can use GLib.Markup.Escape to
escape any text that you don't want parsed.

Otherwise, you should be aware that the default foreground rendering
color for a rendering operation comes from the Gdk.GC (graphics
context) used in the operation.

If you are rendering with a Gtk.Style object, this contains GCs with
the style's colors for the different kinds of things you can draw and
their different states. You can replace the style's text GC using

If you are using the Gdk.Window as a Gdk.Drawable directly, then you
need to have created a GC that you can pass to the draw calls. Be
careful to re-use such GCs and dispose them correctly, as they use

Michael Hutchinson

More information about the Gtk-sharp-list mailing list