The first thing would be to let GraphicsBuilder render the text, or any GraphicsOperation for that matter, to an offscreen image, an option that it didn't have before today but is very easy to accomplish, as shown in the following example
GraphicsRenderer will create a BufferedImage of the appropriate dimensions if you do not define one, it will also clip it if you do not do so

The second part of the builder equation is MarkupBuilder, but as René kindly answered back, his code embeds the produced images using a quick set of methods that do not belong to MarkupBuilder, that is why he went with the option of using a GString. Here we may have 3 alternatives:
- Extend MarkupBuilder and plug in the custom methods. This requires getting a hold of MarkupBuilder internals.
- Extend MArkupBuilder via ExpandoMetaClass. It also requires knowing about MarkupBuilder internals and ExpandoMetaClass, but you save on making a subclass.
- Plug in a factory into MarkupBuilder. Sadly this is a no go, as MarkupBuilder does not extend FactoryBuilderSupport, but it would be nice if it did.
Keep on Groovying!