com.davisor.graphics
Class StringBounds

java.lang.Object
  extended bycom.davisor.graphics.StringBounds

public class StringBounds
extends java.lang.Object

StringBounds implements a simple string bounds computation tool that fixes a frustrating bug in at least some Java2D implementations. The bug causes Java2D to fail to compute string bounds when the font size is too small. This tool fixes the problem by normalizing the font size during the bounds computation, and by scaling the resulting bounding box down again.

Since:
JDK1.1
See Also:
Font.getStringBounds(char[], int, int, java.awt.font.FontRenderContext)

Constructor Summary
StringBounds(java.awt.Font font)
          Creates a new string bounds computer for the given font.
 
Method Summary
 java.awt.geom.Rectangle2D getBounds(java.lang.String string)
          Computes the given string bounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringBounds

public StringBounds(java.awt.Font font)
Creates a new string bounds computer for the given font.

Method Detail

getBounds

public java.awt.geom.Rectangle2D getBounds(java.lang.String string)
Computes the given string bounds.



Copyright © 2001-2004 Davisor Oy. All Rights Reserved.