jgnash.ui.report
Class FontUtilities

java.lang.Object
  extended by jgnash.ui.report.FontUtilities

public class FontUtilities
extends java.lang.Object

Utility class to help calculate font sizes for reporting

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
private static java.lang.ref.Reference<java.awt.font.FontRenderContext> contextReference
          Allow the FontRenderContext to be garbage collected as needed
 
Constructor Summary
private FontUtilities()
           
 
Method Summary
private static java.awt.font.FontRenderContext getFontRenderContext()
           
private static int getStringWidth(java.lang.String text, java.awt.Font font)
          Calculates the width of the specified String.
static int getStringWidth(java.lang.String text, ar.com.fdvs.dj.domain.Style style)
          Calculates the width of the specified String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contextReference

private static java.lang.ref.Reference<java.awt.font.FontRenderContext> contextReference
Allow the FontRenderContext to be garbage collected as needed

Constructor Detail

FontUtilities

private FontUtilities()
Method Detail

getStringWidth

private static int getStringWidth(java.lang.String text,
                                  java.awt.Font font)
Calculates the width of the specified String.

Parameters:
text - the text to be weighted.
font - the font to be weighted
Returns:
the width of the given string in 1/72" dpi.

getStringWidth

public static int getStringWidth(java.lang.String text,
                                 ar.com.fdvs.dj.domain.Style style)
Calculates the width of the specified String.

Parameters:
text - the text to be weighted.
style - the style to be weighted
Returns:
the width of the given string in 1/72" dpi.

getFontRenderContext

private static java.awt.font.FontRenderContext getFontRenderContext()