O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Fonts and FontMetrics

The AWT includes two classes that support font manipulation: Font and FontMetrics.

The Font class provides a basic set of fonts and font styles. Because Java is platform independent, fonts such as Helvetica, Times Roman, and so on are always mapped to an available font on the native platform.

The FontMetrics class allows access to the metrics associated with a particular font, including the font's height, leading, ascent and descent, the width of a specified string, etc.

Fonts

With the advent of the Java 2D Api, the Font class has been extended a great deal. In addition, the 2D Api provides a java.awt.font package containing advanced support for fonts, glyphs, and ligatures. Our discussion here will focus on the aspects ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required