A common request to customize 3D objects is the ability to engrave, emboss or make stand-alone text. Previously I’ve done this with triangle based text and it turned out to be a pain. The code paths for subtracting text where very different to engraving. Boolean subtraction operations in triangle space are much more complicated then in voxel space. In addition the vectors for some fonts cross each other and sometimes have zero area which complicate the triangulation process.
Creating voxel spaces from a font is just an extension of the ApplyImage code I discussed in my last post. Java makes creating images from fonts easy. You select the font, its size and style and then render to a Graphics2D object. You can then use this image to create a voxel space using the ApplyImage operator. With that voxel space you can either use it stand alone to create an object or use the Subtract or Union operators to get engraved or embossed text.
Here is an example of stand-alone text:
You can find this example in the apps/lettering directory.