net.rim.device.api.ui
Class FontFamily

java.lang.Object
  |
  +--net.rim.device.api.ui.FontFamily

public class FontFamily
extends Object

Represents a font typeface.

A font family is a collection of font faces (fonts of differing sizes and styles), which belongs to the same typeface.

See Also:
Font

Field Summary
static int CBTF_FONT
          Indicates CBTF font type.
static String FAMILY_SYSTEM
          Name of the system font family.
static int MONO_BITMAP_FONT
          Indicates mono bitmap font type.
static int SCALABLE_FONT
          Indicates scalable font type.
static int SFF4_FONT
          Indicates sff4 font type.
static int TRUE_TYPE_FONT
          Indicates TrueType font type.
static int UNKNOWN_FONT
          Indicates unknown font type.
 
Method Summary
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
static FontFamily forName(String name)
          Retrieves font family by name.
 Font getFont(int style, int height)
          Retrieves a font specified by style and size.
 Font getFont(int style, int height, int units)
          Retrieves a font specified by style and size.
static FontFamily[] getFontFamilies()
          Retrieves the manifest of known font families.
 Font[] getFonts()
          Deprecated. Use getFont(int, int)
 int[] getHeights()
          Retrieves list of heights supported by this font family.
 String getName()
          Retrieves this font family's name.
 boolean isHeightSupported(int height)
          Determines if this font family supports a specific height.
 boolean isStyleSupported(int style)
          Determines if this font family supports a specific style.
 String toString()
          Retrieves a string representation of this font family.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CBTF_FONT

public static int CBTF_FONT
Indicates CBTF font type.
Since:
JDE 4.5.0

FAMILY_SYSTEM

public static String FAMILY_SYSTEM
Name of the system font family.

MONO_BITMAP_FONT

public static int MONO_BITMAP_FONT
Indicates mono bitmap font type.
Since:
JDE 3.7.0

SCALABLE_FONT

public static int SCALABLE_FONT
Indicates scalable font type.
Since:
JDE 3.7.0

SFF4_FONT

public static int SFF4_FONT
Indicates sff4 font type.
Since:
JDE 4.5.0

TRUE_TYPE_FONT

public static int TRUE_TYPE_FONT
Indicates TrueType font type.
Since:
JDE 4.5.0

UNKNOWN_FONT

public static int UNKNOWN_FONT
Indicates unknown font type.
Since:
JDE 3.7.0
Method Detail

equals

public boolean equals(Object obj)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

  • It is reflexive: for any reference value x, x.equals(x) should return true.
  • It is symmetric: for any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the object is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class Object
Since:
JDE 3.7.0

Following copied from class: Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Boolean.hashCode(), Hashtable

forName

public static FontFamily forName(String name)
                          throws ClassNotFoundException
Retrieves font family by name.

Use this method to retrieve the font family object that was registered with your provided name.

Parameters:
name - A name of font family you want to find. One of permitted values is FAMILY_SYSTEM.
Returns:
An instance of the FontFamily identified by name if one exists; otherwise throws ClassNotFoundException. Please note , that because of the font engine fallback mechanism exception will never be thrown. It remains only to preserve a backward compatibility.
Throws:
ClassNotFoundException - , see note above.

getFont

public Font getFont(int style,
                    int height)
Retrieves a font specified by style and size.

Use this method to retrieve a font by specifying the style and size combination you want.

Parameters:
style - Bitmask of desired styles.
height - Desired height, in units specified by the style parameter.
Returns:
Font most closely matching the criteria.
See Also:
Font

getFont

public Font getFont(int style,
                    int height,
                    int units)
Retrieves a font specified by style and size.

Use this method to retrieve a font by specifying the style and size combination you want.

Parameters:
style - Bitmask of desired styles.
height - Desired height, in units specified by the style parameter.
units - Units modifyer in height, as defined by Ui.UNITS_*.
Returns:
Font most closely matching the criteria.
Since:
JDE 3.7.0
See Also:
Font

getFontFamilies

public static FontFamily[] getFontFamilies()
Retrieves the manifest of known font families.

Use this method to retrieve an array of all the font families registered with the system.

Returns:
Array of registered font family objects.

getFonts

public Font[] getFonts()
Deprecated. Use getFont(int, int)

Retrieves fonts provided in this family.

If this font family supports scalable fonts, this method should return null.

Returns:
Array of Font objects supported by this family.

getHeights

public int[] getHeights()
Retrieves list of heights supported by this font family.
Returns:
Array of heights supported by this family.

getName

public final String getName()
Retrieves this font family's name.

Returns:
Name of this font family.

isHeightSupported

public final boolean isHeightSupported(int height)
Determines if this font family supports a specific height.

Use this method to determine if this font family contains a font of a specific font height.

Parameters:
height - Font height you want to check.
Returns:
True if this font family contains a font of the height you specify; otherwise, false.

isStyleSupported

public boolean isStyleSupported(int style)
Determines if this font family supports a specific style.

Use this method to determine if this font family supports a given font style.

Subclasses of FontFamily must implement this method. We recommend that this method should return true only if every font contained in the font family supports the specified style.

Parameters:
style - Font style you want to check (that is, PLAIN, BOLD, and so on.)
Returns:
This method always returns true.
See Also:
Font

toString

public String toString()
Retrieves a string representation of this font family.

By default, this method returns only the font family's name.

Overrides:
toString in class Object
Returns:
String representation of this font family.



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.