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 ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.