I'm looking for a way to infer a Java AWT Font size from a width. For example, I know I want to write 'hello world' within 100 pixels. I know I'm using the font "Times", in style `Font.PLAIN`, and I want to get the font size that fits the best with my given width of 100 pixels.

I know I could calculate it in a loop (something like `while(font.getSize() < panel.getWidth()`), but to be honest I don't find it very elegant.