API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt. Font View Source
Author(s)
Since
Version
Serial
Hierarchy
 Object
      Font
Implements
 Serializable
Subclasses
Description
public class Font
  The Font class represents fonts, which are used to render text in a visible way.
See also:   
Constructors
private Font (sun.font.AttributeValues values, String oldName, int oldStyle, boolean created, sun.font.Font2DHandle handle)
private Font (File fontFile, int fontFormat, boolean isCopy) throws FontFormatException
protected Font (Font font)
  Creates a new Font from the specified font.
public Font (Map<Attribute, Object> attributes)
  Creates a new Font with the specified attributes.
private Font (String name, int style, float sizePts)
private Font (String name, int style, float sizePts, boolean created, sun.font.Font2DHandle handle)
public Font (String name, int style, int size)
  Creates a new Font from the specified name, style and point size.
Methods
Hide/Show inherited methods
public boolean canDisplay (char c)
  Checks if this Font has a glyph for the specified character.
public boolean canDisplay (int codePoint)
  Checks if this Font has a glyph for the specified character.
public int canDisplayUpTo (char[] text, int start, int limit)
  Indicates whether or not this Font can display the characters in the specified text starting at start and ending at limit.
public int canDisplayUpTo (CharacterIterator iter, int start, int limit)
  Indicates whether or not this Font can display the text specified by the iter starting at start and ending at limit.
public int canDisplayUpTo (String str)
  Indicates whether or not this Font can display a specified String.
publicstatic Font createFont (int fontFormat, File fontFile) throws FontFormatException IOException
  Returns a new Font using the specified font type and the specified font file.
publicstatic Font createFont (int fontFormat, InputStream fontStream) throws FontFormatException IOException
  Returns a new Font using the specified font type and input data.
public GlyphVector createGlyphVector (FontRenderContext frc, char[] chars)
  Creates a GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
public GlyphVector createGlyphVector (FontRenderContext frc, CharacterIterator ci)
  Creates a GlyphVector by mapping the specified characters to glyphs one-to-one based on the Unicode cmap in this Font.
public GlyphVector createGlyphVector (FontRenderContext frc, int[] glyphCodes)
  Creates a GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
public GlyphVector createGlyphVector (FontRenderContext frc, String str)
  Creates a GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
publicstatic Font decode (String str)
  Returns the Font that the str argument describes.
public Font deriveFont (AffineTransform trans)
  Creates a new Font object by replicating the current Font object and applying a new transform to it.
public Font deriveFont (float size)
  Creates a new Font object by replicating the current Font object and applying a new size to it.
public Font deriveFont (int style)
  Creates a new Font object by replicating the current Font object and applying a new style to it.
public Font deriveFont (int style, AffineTransform trans)
  Creates a new Font object by replicating this Font object and applying a new style and transform.
public Font deriveFont (int style, float size)
  Creates a new Font object by replicating this Font object and applying a new style and size.
public Font deriveFont (Map<Attribute, Object> attributes)
  Creates a new Font object by replicating the current Font object and applying a new set of font attributes to it.
public boolean equals (Object obj)
  Compares this Font object to the specified Object.
protected void finalize () throws Throwable
Disposes the native Font object.
public Map<TextAttribute, Object> getAttributes ()
  Returns a map of font attributes available in this Font.
public Attribute getAvailableAttributes ()
  Returns the keys of all the attributes supported by this Font.
public byte getBaselineFor (char c)
  Returns the baseline appropriate for displaying this character.
pack-privatefinal String getFamily_NoClientCode ()
public String getFamily ()
  Returns the family name of this Font.
public String getFamily (Locale l)
  Returns the family name of this Font, localized for the specified locale.
publicstatic Font getFont (Map<Attribute, Object> attributes)
  Returns a Font appropriate to the attributes.
publicstatic Font getFont (String nm)
  Returns a Font object from the system properties list.
publicstatic Font getFont (String nm, Font font)
  Gets the specified Font from the system properties list.
public String getFontName ()
  Returns the font face name of this Font.
public String getFontName (Locale l)
  Returns the font face name of the Font, localized for the specified locale.
public float getItalicAngle ()
  Returns the italic angle of this Font.
public LineMetrics getLineMetrics (char[] chars, int beginIndex, int limit, FontRenderContext frc)
  Returns a LineMetrics object created with the specified arguments.
public LineMetrics getLineMetrics (CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)
  Returns a LineMetrics object created with the specified arguments.
public LineMetrics getLineMetrics (String str, FontRenderContext frc)
  Returns a LineMetrics object created with the specified String and FontRenderContext.
public LineMetrics getLineMetrics (String str, int beginIndex, int limit, FontRenderContext frc)
  Returns a LineMetrics object created with the specified arguments.
public Rectangle2D getMaxCharBounds (FontRenderContext frc)
  Returns the bounds for the character with the maximum bounds as defined in the specified FontRenderContext.
public int getMissingGlyphCode ()
  Returns the glyphCode which is used when this Font does not have a glyph for a specified unicode code point.
public String getName ()
  Returns the logical name of this Font.
public int getNumGlyphs ()
  Returns the number of glyphs in this Font.
pack-privatefinal FontPeer getPeer_NoClientCode ()
@Deprecated
public FontPeer getPeer ()
  Gets the peer of this Font.
public String getPSName ()
  Returns the postscript name of this Font.
public int getSize ()
  Returns the point size of this Font, rounded to an integer.
public float getSize2D ()
  Returns the point size of this Font in float value.
public Rectangle2D getStringBounds (char[] chars, int beginIndex, int limit, FontRenderContext frc)
  Returns the logical bounds of the specified array of characters in the specified FontRenderContext.
public Rectangle2D getStringBounds (CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)
  Returns the logical bounds of the characters indexed in the specified CharacterIterator in the specified FontRenderContext.
public Rectangle2D getStringBounds (String str, FontRenderContext frc)
  Returns the logical bounds of the specified String in the specified FontRenderContext.
public Rectangle2D getStringBounds (String str, int beginIndex, int limit, FontRenderContext frc)
  Returns the logical bounds of the specified String in the specified FontRenderContext.
public int getStyle ()
  Returns the style of this Font.
public AffineTransform getTransform ()
  Returns a copy of the transform associated with this Font.
public int hashCode ()
  Returns a hashcode for this Font.
public boolean hasLayoutAttributes ()
  Return true if this Font contains attributes that require extra layout processing.
public boolean hasUniformLineMetrics ()
  Checks whether or not this Font has uniform line metrics.
public boolean isBold ()
  Indicates whether or not this Font object's style is BOLD.
public boolean isItalic ()
  Indicates whether or not this Font object's style is ITALIC.
public boolean isPlain ()
  Indicates whether or not this Font object's style is PLAIN.
public boolean isTransformed ()
  Indicates whether or not this Font object has a transform that affects its size in addition to the Size attribute.
public GlyphVector layoutGlyphVector (FontRenderContext frc, char[] text, int start, int limit, int flags)
  Returns a new GlyphVector object, performing full layout of the text if possible.
public String toString ()
  Converts this Font object to a String representation.
Fields
Hide/Show inherited fields
publicfinalstatic int BOLD = "1"
  The bold style constant.
publicfinalstatic int CENTER_BASELINE = "1"
The baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text.
publicfinalstatic String DIALOG = "Dialog"
  A String constant for the canonical family name of the logical font "Dialog".
publicfinalstatic String DIALOG_INPUT = "DialogInput"
  A String constant for the canonical family name of the logical font "DialogInput".
publicfinalstatic int HANGING_BASELINE = "2"
The baseline used in Devanigiri and similar scripts when laying out text.
pack-privatetransient int hash
publicfinalstatic int ITALIC = "2"
  The italicized style constant.
publicfinalstatic int LAYOUT_LEFT_TO_RIGHT = "0"
A flag to layoutGlyphVector indicating that text is left-to-right as determined by Bidi analysis.
publicfinalstatic int LAYOUT_NO_LIMIT_CONTEXT = "4"
A flag to layoutGlyphVector indicating that text in the char array after the indicated limit should not be examined.
publicfinalstatic int LAYOUT_NO_START_CONTEXT = "2"
A flag to layoutGlyphVector indicating that text in the char array before the indicated start should not be examined.
publicfinalstatic int LAYOUT_RIGHT_TO_LEFT = "1"
A flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis.
publicfinalstatic String MONOSPACED = "Monospaced"
  A String constant for the canonical family name of the logical font "Monospaced".
protected String name
  The logical name of this Font, as passed to the constructor.
publicfinalstatic int PLAIN = "0"
The plain style constant.
protected float pointSize
  The point size of this Font in float.
publicfinalstatic int ROMAN_BASELINE = "0"
The baseline used in most Roman scripts when laying out text.
publicfinalstatic String SANS_SERIF = "SansSerif"
  A String constant for the canonical family name of the logical font "SansSerif".
publicfinalstatic String SERIF = "Serif"
  A String constant for the canonical family name of the logical font "Serif".
protected int size
  The point size of this Font, rounded to integer.
protected int style
  The style of this Font, as passed to the constructor.
publicfinalstatic int TRUETYPE_FONT = "0"
  Identify a font resource of type TRUETYPE.
publicfinalstatic int TYPE1_FONT = "1"
  Identify a font resource of type TYPE1.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar