0

I want to calculate font size by having height (in px) of area in which single char is drawn.

To draw a char I use :

g2.drawString(value, startX, startY );

How can I determine font size for specific height?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Volodymyr Levytskyi
  • 3,364
  • 9
  • 46
  • 83
  • 1
    There are a number of ways to do it. I generally get a `Shape` from the `GlyphVector`. E.G. as seen in [this answer](http://stackoverflow.com/a/6296381/418556) or [this answer](http://stackoverflow.com/a/18686753/418556).. – Andrew Thompson May 28 '14 at 12:21
  • 1
    Also consider `g2.getFontMetrics()` or `TextLayout`, seen [here](http://stackoverflow.com/search?tab=votes&q=user%3a230513%20textLayout). – trashgod May 28 '14 at 17:53

0 Answers0