TextAsGraphics Library

Using my experience working on libjcsi, I created a small Java library which implements a monospaced graphical text area to be used as a swing component.

This library was requested by a fellow graduate student who was having issues ensuring monospace support with a decent looking font in a cross-system application. Having seen what libjcsi could do, but wanting a lighter weight component that could be included in a Swing GUI more easily, he asked me to work on the problem.

Using a graphics pane to render the fonts means that any font can be used and it will become monospaced. Naturally some fonts look better in this configuration than others, but through a combination of intelligently calculating likely character sizes to be used and centering of said characters in their space, the renderings look at least decent for most fonts.

Small sample application showing the library displaying an arbitrary font in a monospaced fashion.

Leave a Reply

Your email address will not be published. Required fields are marked *