CONTENTS | PREV | NEXT Java 2D API



CHAPTER 4

Text Layout and Fonts

You can use the Java 2D API transformation and drawing mechanisms with text strings. In addition, the Java 2D API provides text-related classes that support sophisticated text layout and fine-grain font control. For example, the Font class has been enhanced to support the specification of detailed font information and enable access to information about a font and its glyphs.

This chapter focuses on the new layout and font capabilities supported through interfaces and classes in java.awt and java.awt.font. For information about text analysis and internationalization, refer to the java.text documentation and the "Writing Global Programs" track in the Java Tutorial.

Note: The information on international text layout contained in this chapter is based on the paper "International Text in JDK 1.2" by Mark Davis, Doug Felt, and John Raley, copyright 1997, Taligent, Inc.


4.0.1 Interfaces




Interface

Description

MultipleMaster

Represents Type 1 Multiple Master fonts.

OpenType

Represents Open Type and True Type fonts.

TextAttributes

Defines attributes and values used by the text layout classes.


4.0.2 Classes




Class

Description

Font

Represents an instance of a font face from the collection of font faces available on the host system. Supports the specification of detailed font information and provides access to information about the font and its glyphs. (In java.awt package.)

GlyphJustificationInfo

Represents information about the justification properties of a glyph, such as weight, priority, absorb, and limit.

GlyphMetrics

Provides metrics for a single glyph.

GlyphSet

An array of glyphs and glyph locations. The lowest level of information used to draw text. Exact glyph codes and positions are used.

GraphicAttribute

Base class for a TextLayout attribute that specifies a graphic embedded in text.

Highlight

Encapsulates and renders a text highlight area.

ImageGraphicAttribute

Extends: GraphicAttribute

A GraphicsAttribute that specifies an embedded Image.

LineBreakMeasurer

Breaks a block of text that spans multiple lines into TextLayout objects that fit within a given line length.

ShapeGraphicAttribute

Extends: GraphicAttribute

A GraphicsAttribute that specifies an embedded Shape.

StyledString

Encapsulates information needed to draw text.

StyledStringIterator

Implements the AttributedCharacterIterator protocol for a StyledString.

TextAttributeSet

Defines attributes and values used by the text layout classes.

TextHitInfo

Represents hit test information for characters in a TextLayout.

TextLayout

Implements: Cloneable

Encapsulates extensions to the layout information for drawing text.



CONTENTS | PREV | NEXT
Copyright © 1997-1998 Sun Microsystems, Inc. All Rights Reserved.