[Gtk-sharp-list] RE: Inserting attributes into a Pango.Layout
Willem J.W. Semmelink
willems@digicore.co.za
Tue, 24 Feb 2004 16:53:24 +0200
Hi Tiago
I did the following:
Pango.Layout layout =3D dc.CreatePangoLayout("Hello There");
if (layout.Attributes =3D=3D null)=20
{
System.Console.WriteLine("Attributes is NULL");
}
Nothing was output to the console. I then confirmed by running in the=20
Visual Studio debugger - it never executed the WriteLine statement.=20
So I guess Attributes is never null by me - perhaps a difference between =
0.15 and 0.16?
I get the error messages to the console only when I add the lines:
Pango.Attribute attribute =3D Pango.Attr.ForegroundNew(0xff, 0, 0); // =
red
attribute.start_index =3D 0;
attribute.end_index =3D 1;
layout.Attributes.Insert(attribute);
The error messages also indicate a list being NULL, but in my case I =
doubt that it is the=20
Attributes list. The next step would be to inspect the C code at the =
reported line.
I only work with the Gtk# binaries, so I haven't ventured that far yet.
Regards,=20
Willem
-----Original Message-----
From: Tiago Lima [mailto:tiago.lima@vianw.pt]
Sent: 24 February 2004 03:28 PM
To: gtk-sharp-list@lists.ximian.com
Cc: Willem J.W. Semmelink
Subject: Re: [Gtk-sharp-list] RE: Inserting attributes into a
Pango.Layout
I think the problem appears to be that when:
Pango.Layout layout =3D dc.CreatePangoLayout("Hello There");
the "layout.Attributes" in my case is NULL !!! which I had to make:
layout.Attribute =3D new AttrList();
but in this case one wonders what needs to be initialized appart from =
this=20
"new" statement... Should it be NULL ? Is it NULL in your case ? Try =
making=20
an "if (layout.Attributes =3D=3D null) <something>" right after the=20
CreatePangoLayout to see if its null or so...
Oh, I'm using Gtk# 0.16... didnt try with 0.15 though...
Thanks,
Tiago Lima