[Gtk-sharp-list] pango/gtk# and fonts

Lee Mallabone gnome@fonicmonkey.net
15 Sep 2002 22:02:34 +0100

Content-Type: text/plain
Content-Transfer-Encoding: 7bit


I'm trying to set a custom font on a widget with Gtk#. I'm trying to use
the FontDescription.FromString() method in Pango# so that it doesn't
require too much effort.

However, that method always seems to return null. Is this a known bug or
am I using things wrong?

If it's unimplemented and I can help implementing it, please point me to
where I can add code to Gtk# to make custom font things work?

I've attached a simple bit of code that illustrates my problem. It
always prints "no font present" regardless of my font description.


Lee Mallabone.

Content-Disposition: attachment; filename=fontTest.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=fontTest.cs; charset=ANSI_X3.4-1968

using Gnome;
using Gtk;
using Pango;
using System;

public class fontTest : App
 public static int Main(string[] args)
  	Program fontTest =3D new Program("fontTest", "0.1", Modules.UI, args);=09
  	new fontTest().ShowAll();
	return 0;
 public fontTest(): base("test", "fontTest")
 	FontDescription newFont =3D FontDescription.FromString("Serif Regular 48"=
	Label aLabel =3D new Label("Hello world, testing font setting!");
	if (newFont !=3D null)
	 	Console.WriteLine("Setting font...");
	 	Console.WriteLine("Font not present!");
  	Contents =3D aLabel;