开发者

Java, pixels in a given letter of a particular Font

How can I determine how many pixels are in a specific letter of a specific Font i开发者_StackOverflown Java?


If you have the font loaded as a Font object, you can create a new FontMetrics object (or one of its children if your graphics toolkit has one) and its charWidth(char ch) method to determine its size. The units aren't listed in the manual, but I'm assuming pixels.

Likewise, there's a stringWidth method to get the width of an entire String.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜