O'Reilly logo

Platinum Edition Using XHTML™, XML, and Java™ 2 by Andrew H. Watt, Mike Morgan, Jim O'Donnell, Eric Ladd

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

Displaying Text

Java's Graphics class provides seven methods related to displaying text. Before plunging into the various aspects of drawing text, however, you should be familiar with the following common terms for fonts and text:

  • Baseline— The imaginary line that the text rests on.

  • Descent— The distance below the baseline that a particular character extends. The letters g and j, for example, extend below the baseline.

  • Ascent— The distance above the baseline that a particular character extends. For example, the letter d has a higher ascent than the letter x.

  • Leading— The space between a line of text's lowest descent and the following line of text's highest ascent. Without leading, the letters g and j would touch the letters M and h on the next line. ...

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