If you have a large number of fonts installed on your system, you generally want to be able to browse them. The standard Gnome font selector can be used as a browser but it will only inform you of which fonts are findable with Fontconfig. The problem here is that if you have two versions of the same font, e.g. a PostScript Type 1 and a TrueType version of the same font, then you can only access one of the fonts – whichever the Fontconfig search finds first.
There are browsers such as gfontview but these are old programs that do not use Pango and Fontconfig so whilst they can be used for browsing fonts if you know where the files are, they really are not useful for finding out which fonts are on the Fontconfig path and which are the fonts available, i.e. not hidden to the Fontconfig search.
In early 2005, I wrote a zeroth draft of a program for browsing fonts where all fonts on the system in the Fontconfig paths are presented. The program isn't good, it definitely needs a lot more work on it but it was my first gtkmm program and the first time I worked with Fontconfig. It more or less does what I needed when I wrote the program and I haven't had need to evolve it, though it desparately needs it!
Despite its ‘unsophisticated’ state, people said I should release it under GPL so here it is. You can download the v0.1.2 tarball by clicking here. Having started with Subversion, then tried Bazaar, I have now switched to Git as the version control system for GFontBrowser. The publicly accessible, cloneable repository is at http://www.russel.org.uk/Git/GFontBrowser_C++, if you just want to browse you probably want to go via this link. If you find any problems or want to make any proposals for improvements, do let me know. Thanks.
2007-02-22, I added the facility to double click on a font and get the Gnome font viewer to display. Turned out to be quick and easy to do, and it adds significantly to the usefulness of GFontBrowser. Declared this to be version 0.1.3, there is a tarball here. For the adventurous there is the Git repository at http://www.russel.org.uk/Git/GFontBrowser_C++.
Disaster – 2007-09-03
In changing from Ubuntu Edgy Eft to Feisty Fawn, and the consequent upgrade of GTK, GTKmm, Fontconfig, and Pango, a function that GFontBrowser relied on had its semantics changed from something sensible to “do nothing”. So GFontBrowser is now completely broken. Ggggrrrrrr........
The problem is the Fontconfig change. In moving from 2.3.x to 2.4.x, FcDirScan has been changed (though the documentation hasn't). As from 2.4.x this function does nothing and returns FcFalse – which is completely worse than useless – the function is being deprecated, but in the interim they have changed the semantics. Ho hum.
Clearly, this needs fixing. I am also going to take the opportunity to fix a long-standing problem with text rendering which means all use of Pango will go. Step 1 though was to move the code from Subversion to Bazaar. The Subversion repository is now no more. Indeed the Bazaar branch is no more as I made the choice to use Git for this project. The code can be got using Git by cloning from http://www.russel.org.uk/Git/GFontBrowser_C++.git. Or you can browse the repository here.
A change of heart
Late in 2007 I was trying to tinker with GFontBrowser again to see what could be done to get around the decimation of Fontconfig functionality and decided to try rewriting the whole thing in Python instead of C++. Initially this was as much to learn about PyGTK as it was to progress GFontBrowser. It strikes me though that writing applications like this is so much easier in Python than in C++. So, at least for the moment, GFontBrowser is now a Python application. No release as yet but the cloneable Git branch is at http://www.russel.org.uk/Git/GFontBrowser_Python.git, or for just browsing the repository click here.
A quick update
So 7 years later, I am still tinkering with this code. In fact I am using the problem as a comparison tool. So there is a C++ version and a Python version (no longer using PyGTK, but using the PyGObject API introspection mechanism as it is now a Python 3 rather than a Python 2 application), I am creating a D version, a Go version and a Vala version. News as there is code.