net.sf.ecl.datepicker.resources
Class Fonts

java.lang.Object
  extended by net.sf.ecl.datepicker.resources.Fonts

public final class Fonts
extends Object

The utility class that provides miscellaneous Fontoperations.

Author:
Alexey Afanasyev, Alexey Kharlamov

Method Summary
static Font getBoldFont(Device device, FontData[] fontData)
          Returns the bold fond based on the given font.
static Font getDefault()
          returns default system font.
static Font getFont(Device device, FontData[] fontData)
          returns font object for the given device/description pair.
static FontMetrics getFontMetrics(Font font)
          Returns the FontMetrics associated with the passed Font.
static Point getTextExtent(String text, Font font)
          Returns the extent of the String text using the font font.
static int getTextWidth(String text, Font font)
          Returns the width of text in Font font.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBoldFont

public static Font getBoldFont(Device device,
                               FontData[] fontData)
Returns the bold fond based on the given font.

Parameters:
device - the device to create the font on
fontData - the original font data array

getDefault

public static Font getDefault()
returns default system font.

Returns:
the default system font.

getFont

public static Font getFont(Device device,
                           FontData[] fontData)
returns font object for the given device/description pair. The font is also cached for later use.

Parameters:
device - the device to allocate font for.
fontData - the font description object.
Returns:
the font.

getFontMetrics

public static FontMetrics getFontMetrics(Font font)
Returns the FontMetrics associated with the passed Font.

Parameters:
font - the font
Returns:
the FontMetrics for the given font
See Also:
GC.getFontMetrics()

getTextExtent

public static Point getTextExtent(String text,
                                  Font font)
Returns the extent of the String text using the font font. Tab expansion and carriage return processing are performed.

Parameters:
text - the text string
font - the font
Returns:
the text's extent
See Also:
GC.textExtent(String)

getTextWidth

public static int getTextWidth(String text,
                               Font font)
Returns the width of text in Font font.

Parameters:
text - the text string
font - the font
Returns:
the width