Following a response from aioobe is a smart way to get graphics. Perhaps everyone understands this, but the Graphics object comes with a specific font, which, using aioobe, can be any general way to get graphics.
I had to do this (Jython):
g = java.awt.image.BufferedImage(1, 1, java.awt.image.BufferedImage.TYPE_INT_RGB).graphics g.font = my_table.font
After that, it gives an exact figure before something is realized ... cheers:
hw_width = g.fontMetrics.stringWidth( "Hello World" )
source share