Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.awt.font
Class FontRenderContext

    java.lang.Object
      |
      +--java.awt.font.FontRenderContext

public class FontRenderContext
extends Object

The `FontRenderContext` class is a container for the information needed to correctly measure text. The measurement of text can vary because of rules that map outlines to pixels, and rendering hints provided by an application.

One such piece of information is a transform that scales typographical points to pixels. (A point is defined to be exactly 1/72 of an inch, which is slightly different than the traditional mechanical measurement of a point.) A character that is rendered at 12pt on a 600dpi device might have a different size than the same character rendered at 12pt on a 72dpi device because of such factors as rounding to pixel boundaries and hints that the font designer may have specified.

Anti-aliasing and Fractional-metrics specified by an application can also affect the size of a character because of rounding to pixel boundaries.

Typically, instances of `FontRenderContext` are obtained from a `Graphics2D` object. A `FontRenderContext` which is directly constructed will most likely not represent any actual graphics device, and may lead to unexpected or incorrect results.

See Also:
  `RenderingHints.KEY_TEXT_ANTIALIASING`, `RenderingHints.KEY_FRACTIONALMETRICS`, `Graphics2D.getFontRenderContext()`, `LineMetrics`

Constructor Summary
`protected` | `FontRenderContext()` Constructs a new `FontRenderContext` object.
`` | `FontRenderContext(AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics)` Constructs a `FontRenderContext` object from an optional `AffineTransform` and two `boolean` values that determine if the newly constructed object has anti-aliasing or fractional metrics.

Method Summary
`AffineTransform` | `getTransform()` Gets the transform that is used to scale typographical points to pixels in this `FontRenderContext`.
`boolean` | `isAntiAliased()` Gets the text anti-aliasing mode used in this `FontRenderContext`.
`boolean` | `usesFractionalMetrics()` Gets the text fractional metrics mode requested by the application for use in this `FontRenderContext`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FontRenderContext

    protected FontRenderContext()

  Constructs a new `FontRenderContext` object.

### FontRenderContext

    public FontRenderContext(AffineTransform tx,
                             boolean isAntiAliased,
                             boolean usesFractionalMetrics)

  Constructs a `FontRenderContext` object from an optional `AffineTransform` and two `boolean` values that determine if the newly constructed object has anti-aliasing or fractional metrics.
  Parameters:
    `tx` - the transform which is used to scale typographical points to pixels in this `FontRenderContext`. If null, an identity tranform is used.
    `isAntiAliased` - determines if the newly contructed object has anti-aliasing
    `usesFractionalMetrics` - determines if the newly constructed object uses fractional metrics

Method Detail

### getTransform

    public AffineTransform getTransform()

  Gets the transform that is used to scale typographical points to pixels in this `FontRenderContext`.
  See Also:
    `AffineTransform`

### isAntiAliased

    public boolean isAntiAliased()

  Gets the text anti-aliasing mode used in this `FontRenderContext`.
  See Also:
    `RenderingHints.KEY_TEXT_ANTIALIASING`

### usesFractionalMetrics

    public boolean usesFractionalMetrics()

  Gets the text fractional metrics mode requested by the application for use in this `FontRenderContext`.
  See Also:
    `RenderingHints.KEY_FRACTIONALMETRICS`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.