posted 19 years ago
Here's a demo that explores font properties. I put everything inside the paintComponent method for the demo but you can just as easily do the computations outside, ie, without the graphics context — check out the three–argument constructor in the FontRenderContext api. You can use null for the AffineTransform argument.
Also check the Font getStringBounds and LineMetrics getHeight methods for information on what is included in the height. I left out the leading in the demo. You can experiment with the height factors to get the results you need; endless fun...