• Post Reply Bookmark Topic Watch Topic
  • New Topic

Drawing strings in Java  RSS feed

 
Anonymous AnonymousAnonymous
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have some questions regarding drawing strings in Java, more exactly regarding the determination and measurement of the size of strings.

The API says that the unit of the parameter size in the constructor Font(String name, int style, int size) is point. But how is the relationship between points and pixels in Java? I found serveral resources on the web which all say different things.

Some states that in Java one point is equal to one pixel. Others say that Java knows points as well as pixels and that one point is not necessarily one pixel. But what's right? I searched the API and others official Sun documents (eg. the tutorials), but I can't find any official resource from Sun in which the relation between pixels and points is explained - neither statements that one point is equal to one pixel nor statements against that. Does any one have a link where Sun explains that?

Second question: What exactly is the size of a font which I give the constructor Font(String name, int style, int size)? Is it the distance from the font's baseline to the top of most alphanumeric characters? Or the distance from the bottom of most alphanumeric characters with descenders to the top of most alphanumeric characters?

Third question: Do the methods of the class FontMetrics such as getLeading(), getAscent() or getDescent() return pixel values or point values? If there is a difference at all...

Best regards
Fiete
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!