I don't have access to a Mac, but I'd like to get a list of fonts available to OSX Pango/Cairo.

I also haven't sorted out getting a FreeBSD (or any other BSD) machine set up with X11, D, and GtkD, etc. either, so if someone could cover that base for me, too...

I've written a little GtkD utility that'll do the job, so if you have GtkD installed on a Mac or BSD system, all you have to do is compile and run it in a terminal, redirect the list to a text file, post it back here, and Bob's yer uncle... well, maybe My uncle since I'm the one who wants this done.

This is for a post about GTK MVC that I'm working on for the gtkDcoding blog and if you don't know what that is...

It's my little contribution to the furtherance of D and GTK, a blog giving examples of as many aspects of GtkD as I can manage to squeeze out before I go stark, raving mad or run out of things GTK to cover, whichever comes first.

Here's the code:


// Test Rig Foundation for Learning GtkD Coding

import std.stdio;

import gtk.MainWindow;
import gtk.Main;
import gtk.Box;
import gtk.Widget;
import pango.PgCairoFontMap;
import pango.PgFontMap;
import pango.PgFontFamily;

void main(string[] args)
{
	Main.init(args);

	TestRigWindow myTestRig = new TestRigWindow("Test Rig");
	
	Main.run();
	
} // main()


class TestRigWindow : MainWindow
{
	AppBox appBox;
	PgFontMap pgFontMap;
	PgFontFamily[] pgFontFamilies;
	PgFontFamily font;
	
	this(string title)
	{
		super(title);
		addOnDestroy(&quitApp);
		
		appBox = new AppBox();
		add(appBox);

// this becomes part of MVC IX - TreeView with a list of system fonts (may even have font samples)
		pgFontMap = PgCairoFontMap.getDefault();
		pgFontMap.listFamilies(pgFontFamilies);
		
		writeln("A list of all fonts available to Pango on this computer:");

		foreach(font; pgFontFamilies)
		{
			writeln(font.getName());
			
		}
		
		showAll();

	} // this() CONSTRUCTOR
	
		
	void quitApp(Widget widget)
	{
		writeln("Bye.");
		Main.quit();
		
	} // quitApp()

} // class myAppWindow


class AppBox : Box
{
	// add child object definitions here
	
	this()
	{
		super(Orientation.VERTICAL, 10);
		
		// instantiate child objects here
		
		// packStart(<child object>, false, false, 0); // LEFT justify
		// packEnd(<child object>, false, false, 0); // RIGHT justify
		
	} // this()

} // class AppBox

Thanks for even just thinking about doing this.