This content has been marked as final. Show 3 replies
i'm not sure you can chose that from drawString() method ; however, this link may interest you:
thank you the FontMetris.getStringBounds(String str, Graphics context) looks exactly like what I'm looking for :-)
these questions should be asked in the swing/java2d section.
getStringBounds() doesnt return a pixel perfect bounding box. vertically, the box
is usually twice as tall and somewhat centered. if you want a pixel perfect box
you can use TextLayout. someone showed me how to do this in one of my old
posts, ill try to dig it up.