Rent-a-founder

Adventures in Clojure: The Font Manager

I’ve contributed to Github projects before but I’ve just now uploaded my first own Github repository: The Font Manager. It combines two things I’ve been wanting to do for a quite a while:

  • Learn to program in Clojure
  • Write a font manager / viewer that can look into ZIP archives

There are lots of font viewers out there. But for some reason, I wasn’t able to find one that could search ZIP files. Most downloaded fonts come in ZIP archives. It makes sense: It is almost never just one font file but multiple variations and formats, along with licensing information. For obvious reasons, I don’t install them all so they end up in a directory on my computer. When I need to find a font for some design work, I’d simply like to browse them. But most font viewers are very limited regarding browsing locally saved fonts. So I created that font browser myself. In the end, it’s a Java server process which can be accessed in a web browser. It is not meant to face the outside world. I just used HTML/CSS/Javascript for the GUI because it works everywhere. Here’s a screenshot:

Font Manager Screenshot

It is also the first project I wrote in functional programming language Clojure. I do enjoy Clojure. Although it’s my first real functional programming language (at university, we used to make fun of students who were forced to learn LISP), it wasn’t very hard to learn. I guess the years of having to write lots of Javascript paid off. This page helped tremendously. Clojure is great for processing data and the fact that it’s built on the Java VM makes it really easy to build a tool like the Font Manager. Complex computations can be written in only few lines of code. This fact, however, can also make it hard to understand code. It took some time to get used to it.

Writing Clojure, I also used the IDE Light Table. Its main promise is that it evaluates your code as you write it. This sounds nice and it certainly can be. But it breaks down when you develop something like an HTTP server (or maybe I couldn’t get it to work, it’s hard to tell). I often had to copy large parts of the code to the “Instarepl” to see a live evaluation. In my opinion, Light Table has a long way to go and with recent announcements, I’m not sure that is going to happen.

But Clojure is nice and I’m looking forward to writing more code with it (Rich Hickey’s announcement about transducers makes me want to get more into it). If I had one wish, though, it would be that the Clojure team work on simplifying error messages and call stacks (that part’s a mess). And that Clojure became a bit more popular.