[Gtk-sharp-list] Gtk.Style vs Pango - I'm confused...

Anset anset@anset.org
Thu, 16 Sep 2004 17:52:44 +0200


Hi,

Maybe I'm just plain stupid, but I am getting more than a bit confused with
Pango and Gtk.Style.

I was looking for a way to change the font on a widget and I landed on these
two.
The more I read about them, the less I understand it.

It looks like Style was there before Pango, but Pango does not replace it.
Pango does "just text", if you allow the understatement. However Style does
"text also"...

One example of something that puzzles me:

Gtk.Style has a Pango.FontDescription propperty.
Pango.Context has a Pango.FontDesctiption propperty.

A Gtk.Widget has both a Gtk.Style and a  Pango.Context propperty.

So which one do I use to change the Font?

It gets even worse:

for example, in the following function call from the DrawingArea class
example (this being a DrawingArea subclass object) :

                this.GdkWindow.DrawLayout (this.Style.TextGC
(StateType.Normal), 100, 150, layout);

with
                layout = new Pango.Layout (this.PangoContext);
                layout.Wrap = Pango.WrapMode.Word;
                layout.FontDescription = FontDescription.FromString ("Tahoma
16");
                layout.SetMarkup ("Hello Pango.Layout");

We now have 3 possible fonts:
    - the wigets Style font
    - the widgets Pango.Context  font
    - and the layout's font.

I do not get it.

Can somebody tell me how Pango fits in? I read the material on the Pango
home site, but even though that helped me to understand Pango, I still do
not see how it fits in Gtk.

Any help is greatly appreciated.

Anset.

PS.  In older GTK, there used to be a gtk_widget_get_default_style function.
       Does anything like this still exist? And is it usable?