• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue with stringWidth() method of FontMetrics class  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

We have an application supporting different languages.
In order to set the bounds of the tooltip, we require is to calculate the width based on the width of the string.

I'm doing the following :
FontMetrics fm = getFontMetrics(this.cellFont);
int width = fm.stringWidth(tip);

Issue is : length of the string and Font remaining same, if any accented character appears in the string, width returned is same. But while actual display of accented characters it is taking more space.
Hence my strings are getting cut when shown in the tooltip.

Is there any known issue for stringWidth() method of FontMetrics?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!