java.awt
Class Font

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.Font
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
FontUIResource sample code for javax.swing.plaf.FontUIResource definition code for javax.swing.plaf.FontUIResource

public class Font
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

The Font class represents fonts, which are used to render text in a visible way. A font provides the information needed to map sequences of characters to sequences of glyphs and to render sequences of glyphs on Graphics and Component objects.

Characters and Glyphs

A character is a symbol that represents an item such as a letter, a digit, or punctuation in an abstract way. For example, 'g', LATIN SMALL LETTER G, is a character.

A glyph is a shape used to render a character or a sequence of characters. In simple writing systems, such as Latin, typically one glyph represents one character. In general, however, characters and glyphs do not have one-to-one correspondence. For example, the character 'á' LATIN SMALL LETTER A WITH ACUTE, can be represented by two glyphs: one for 'a' and one for '´'. On the other hand, the two-character string "fi" can be represented by a single glyph, an "fi" ligature. In complex writing systems, such as Arabic or the South and South-East Asian writing systems, the relationship between characters and glyphs can be more complicated and involve context-dependent selection of glyphs as well as glyph reordering. A font encapsulates the collection of glyphs needed to render a selected set of characters as well as the tables needed to map sequences of characters to corresponding sequences of glyphs.

Physical and Logical Fonts

The Java 2 platform distinguishes between two kinds of fonts: physical fonts and logical fonts.

Physical fonts are the actual font libraries containing glyph data and tables to map from character sequences to glyph sequences, using a font technology such as TrueType or PostScript Type 1. All implementations of the Java 2 platform must support TrueType fonts; support for other font technologies is implementation dependent. Physical fonts may use names such as Helvetica, Palatino, HonMincho, or any number of other font names. Typically, each physical font supports only a limited set of writing systems, for example, only Latin characters or only Japanese and Basic Latin. The set of available physical fonts varies between configurations. Applications that require specific fonts can bundle them and instantiate them using the createFont sample code for java.awt.Font.createFont(int, java.io.InputStream) definition code for java.awt.Font.createFont(int, java.io.InputStream) method.

Logical fonts are the five font families defined by the Java platform which must be supported by any Java runtime environment: Serif, SansSerif, Monospaced, Dialog, and DialogInput. These logical fonts are not actual font libraries. Instead, the logical font names are mapped to physical fonts by the Java runtime environment. The mapping is implementation and usually locale dependent, so the look and the metrics provided by them vary. Typically, each logical font name maps to several physical fonts in order to cover a large range of characters.

Peered AWT components, such as Label sample code for java.awt.Label definition code for java.awt.Label and TextField sample code for java.awt.TextField definition code for java.awt.TextField , can only use logical fonts.

For a discussion of the relative advantages and disadvantages of using physical or logical fonts, see the Internationalization FAQ document.

Font Faces and Names

A Font can have many faces, such as heavy, medium, oblique, gothic and regular. All of these faces have similar typographic design.

There are three different names that you can get from a Font object. The logical font name is simply the name that was used to construct the font. The font face name, or just font name for short, is the name of a particular font face, like Helvetica Bold. The family name is the name of the font family that determines the typographic design across several faces, like Helvetica.

The Font class represents an instance of a font face from a collection of font faces that are present in the system resources of the host system. As examples, Arial Bold and Courier Bold Italic are font faces. There can be several Font objects associated with a font face, each differing in size, style, transform and font features. The getAllFonts sample code for java.awt.GraphicsEnvironment.getAllFonts() definition code for java.awt.GraphicsEnvironment.getAllFonts() method of the GraphicsEnvironment class returns an array of all font faces available in the system. These font faces are returned as Font objects with a size of 1, identity transform and default font features. These base fonts can then be used to derive new Font objects with varying sizes, styles, transforms and font features via the deriveFont methods in this class.

See Also:
Serialized Form

Field Summary
static int BOLD sample code for java.awt.Font.BOLD definition code for java.awt.Font.BOLD
          The bold style constant.
static int CENTER_BASELINE sample code for java.awt.Font.CENTER_BASELINE definition code for java.awt.Font.CENTER_BASELINE
          The baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text.
static int HANGING_BASELINE sample code for java.awt.Font.HANGING_BASELINE definition code for java.awt.Font.HANGING_BASELINE
          The baseline used in Devanigiri and similar scripts when laying out text.
static int ITALIC sample code for java.awt.Font.ITALIC definition code for java.awt.Font.ITALIC
          The italicized style constant.
static int LAYOUT_LEFT_TO_RIGHT sample code for java.awt.Font.LAYOUT_LEFT_TO_RIGHT definition code for java.awt.Font.LAYOUT_LEFT_TO_RIGHT
          A flag to layoutGlyphVector indicating that text is left-to-right as determined by Bidi analysis.
static int LAYOUT_NO_LIMIT_CONTEXT sample code for java.awt.Font.LAYOUT_NO_LIMIT_CONTEXT definition code for java.awt.Font.LAYOUT_NO_LIMIT_CONTEXT
          A flag to layoutGlyphVector indicating that text in the char array after the indicated limit should not be examined.
static int LAYOUT_NO_START_CONTEXT sample code for java.awt.Font.LAYOUT_NO_START_CONTEXT definition code for java.awt.Font.LAYOUT_NO_START_CONTEXT
          A flag to layoutGlyphVector indicating that text in the char array before the indicated start should not be examined.
static int LAYOUT_RIGHT_TO_LEFT sample code for java.awt.Font.LAYOUT_RIGHT_TO_LEFT definition code for java.awt.Font.LAYOUT_RIGHT_TO_LEFT
          A flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis.
protected  String sample code for java.lang.String definition code for java.lang.String name sample code for java.awt.Font.name definition code for java.awt.Font.name
          The logical name of this Font, as passed to the constructor.
static int PLAIN sample code for java.awt.Font.PLAIN definition code for java.awt.Font.PLAIN
          The plain style constant.
protected  float pointSize sample code for java.awt.Font.pointSize definition code for java.awt.Font.pointSize
          The point size of this Font in float.
static int ROMAN_BASELINE sample code for java.awt.Font.ROMAN_BASELINE definition code for java.awt.Font.ROMAN_BASELINE
          The baseline used in most Roman scripts when laying out text.
protected  int size sample code for java.awt.Font.size definition code for java.awt.Font.size
          The point size of this Font, rounded to integer.
protected  int style sample code for java.awt.Font.style definition code for java.awt.Font.style
          The style of this Font, as passed to the constructor.
static int TRUETYPE_FONT sample code for java.awt.Font.TRUETYPE_FONT definition code for java.awt.Font.TRUETYPE_FONT
          Identify a font resource of type TRUETYPE.
static int TYPE1_FONT sample code for java.awt.Font.TYPE1_FONT definition code for java.awt.Font.TYPE1_FONT
          Identify a font resource of type TYPE1.
 
Constructor Summary
Font sample code for java.awt.Font.Font(java.util.Map) definition code for java.awt.Font.Font(java.util.Map) (Map sample code for java.util.Map definition code for java.util.Map <? extends AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute ,?> attributes)
          Creates a new Font with the specified attributes.
Font sample code for java.awt.Font.Font(java.lang.String, int, int) definition code for java.awt.Font.Font(java.lang.String, int, int) (String sample code for java.lang.String definition code for java.lang.String  name, int style, int size)
          Creates a new Font from the specified name, style and point size.
 
Method Summary
 boolean canDisplay sample code for java.awt.Font.canDisplay(char) definition code for java.awt.Font.canDisplay(char) (char c)
          Checks if this Font has a glyph for the specified character.
 boolean canDisplay sample code for java.awt.Font.canDisplay(int) definition code for java.awt.Font.canDisplay(int) (int codePoint)
          Checks if this Font has a glyph for the specified character.
 int canDisplayUpTo sample code for java.awt.Font.canDisplayUpTo(char[], int, int) definition code for java.awt.Font.canDisplayUpTo(char[], int, int) (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.
 int canDisplayUpTo sample code for java.awt.Font.canDisplayUpTo(java.text.CharacterIterator, int, int) definition code for java.awt.Font.canDisplayUpTo(java.text.CharacterIterator, int, int) (CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.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.
 int canDisplayUpTo sample code for java.awt.Font.canDisplayUpTo(java.lang.String) definition code for java.awt.Font.canDisplayUpTo(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  str)
          Indicates whether or not this Font can display a specified String.
static Font sample code for java.awt.Font definition code for java.awt.Font createFont sample code for java.awt.Font.createFont(int, java.io.File) definition code for java.awt.Font.createFont(int, java.io.File) (int fontFormat, File sample code for java.io.File definition code for java.io.File  fontFile)
          Returns a new Font using the specified font type and the specified font file.
static Font sample code for java.awt.Font definition code for java.awt.Font createFont sample code for java.awt.Font.createFont(int, java.io.InputStream) definition code for java.awt.Font.createFont(int, java.io.InputStream) (int fontFormat, InputStream sample code for java.io.InputStream definition code for java.io.InputStream  fontStream)
          Returns a new Font using the specified font type and input data.
 GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, char[]) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, char[]) (FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc, char[] chars)
          Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
 GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.text.CharacterIterator) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.text.CharacterIterator) (FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc, CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator  ci)
          Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping the specified characters to glyphs one-to-one based on the Unicode cmap in this Font.
 GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, int[]) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, int[]) (FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc, int[] glyphCodes)
          Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
 GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) (FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc, String sample code for java.lang.String definition code for java.lang.String  str)
          Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
static Font sample code for java.awt.Font definition code for java.awt.Font decode sample code for java.awt.Font.decode(java.lang.String) definition code for java.awt.Font.decode(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  str)
          Returns the Font that the str argument describes.
 Font sample code for java.awt.Font definition code for java.awt.Font deriveFont sample code for java.awt.Font.deriveFont(java.awt.geom.AffineTransform) definition code for java.awt.Font.deriveFont(java.awt.geom.AffineTransform) (AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  trans)
          Creates a new Font object by replicating the current Font object and applying a new transform to it.
 Font sample code for java.awt.Font definition code for java.awt.Font deriveFont sample code for java.awt.Font.deriveFont(float) definition code for java.awt.Font.deriveFont(float) (float size)
          Creates a new Font object by replicating the current Font object and applying a new size to it.
 Font sample code for java.awt.Font definition code for java.awt.Font deriveFont sample code for java.awt.Font.deriveFont(int) definition code for java.awt.Font.deriveFont(int) (int style)
          Creates a new Font object by replicating the current Font object and applying a new style to it.
 Font sample code for java.awt.Font definition code for java.awt.Font deriveFont sample code for java.awt.Font.deriveFont(int, java.awt.geom.AffineTransform) definition code for java.awt.Font.deriveFont(int, java.awt.geom.AffineTransform) (int style, AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  trans)
          Creates a new Font object by replicating this Font object and applying a new style and transform.
 Font sample code for java.awt.Font definition code for java.awt.Font deriveFont sample code for java.awt.Font.deriveFont(int, float) definition code for java.awt.Font.deriveFont(int, float) (int style, float size)
          Creates a new Font object by replicating this Font object and applying a new style and size.
 Font sample code for java.awt.Font definition code for java.awt.Font deriveFont sample code for java.awt.Font.deriveFont(java.util.Map) definition code for java.awt.Font.deriveFont(java.util.Map) (Map sample code for java.util.Map definition code for java.util.Map <? extends AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute ,?> attributes)
          Creates a new Font object by replicating the current Font object and applying a new set of font attributes to it.
 boolean equals sample code for java.awt.Font.equals(java.lang.Object) definition code for java.awt.Font.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Compares this Font object to the specified Object.
protected  void finalize sample code for java.awt.Font.finalize() definition code for java.awt.Font.finalize() ()
          Disposes the native Font object.
 Map sample code for java.util.Map definition code for java.util.Map <TextAttribute sample code for java.awt.font.TextAttribute definition code for java.awt.font.TextAttribute ,?> getAttributes sample code for java.awt.Font.getAttributes() definition code for java.awt.Font.getAttributes() ()
          Returns a map of font attributes available in this Font.
 AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute [] getAvailableAttributes sample code for java.awt.Font.getAvailableAttributes() definition code for java.awt.Font.getAvailableAttributes() ()
          Returns the keys of all the attributes supported by this Font.
 byte getBaselineFor sample code for java.awt.Font.getBaselineFor(char) definition code for java.awt.Font.getBaselineFor(char) (char c)
          Returns the baseline appropriate for displaying this character.
 String sample code for java.lang.String definition code for java.lang.String getFamily sample code for java.awt.Font.getFamily() definition code for java.awt.Font.getFamily() ()
          Returns the family name of this Font.
 String sample code for java.lang.String definition code for java.lang.String getFamily sample code for java.awt.Font.getFamily(java.util.Locale) definition code for java.awt.Font.getFamily(java.util.Locale) (Locale sample code for java.util.Locale definition code for java.util.Locale  l)
          Returns the family name of this Font, localized for the specified locale.
static Font sample code for java.awt.Font definition code for java.awt.Font getFont sample code for java.awt.Font.getFont(java.util.Map) definition code for java.awt.Font.getFont(java.util.Map) (Map sample code for java.util.Map definition code for java.util.Map <? extends AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute ,?> attributes)
          Returns a Font appropriate to this attribute set.
static Font sample code for java.awt.Font definition code for java.awt.Font getFont sample code for java.awt.Font.getFont(java.lang.String) definition code for java.awt.Font.getFont(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  nm)
          Returns a Font object from the system properties list.
static Font sample code for java.awt.Font definition code for java.awt.Font getFont sample code for java.awt.Font.getFont(java.lang.String, java.awt.Font) definition code for java.awt.Font.getFont(java.lang.String, java.awt.Font) (String sample code for java.lang.String definition code for java.lang.String  nm, Font sample code for java.awt.Font definition code for java.awt.Font  font)
          Gets the specified Font from the system properties list.
 String sample code for java.lang.String definition code for java.lang.String getFontName sample code for java.awt.Font.getFontName() definition code for java.awt.Font.getFontName() ()
          Returns the font face name of this Font.
 String sample code for java.lang.String definition code for java.lang.String getFontName sample code for java.awt.Font.getFontName(java.util.Locale) definition code for java.awt.Font.getFontName(java.util.Locale) (Locale sample code for java.util.Locale definition code for java.util.Locale  l)
          Returns the font face name of the Font, localized for the specified locale.
 float getItalicAngle sample code for java.awt.Font.getItalicAngle() definition code for java.awt.Font.getItalicAngle() ()
          Returns the italic angle of this Font.
 LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics getLineMetrics sample code for java.awt.Font.getLineMetrics(char[], int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(char[], int, int, java.awt.font.FontRenderContext) (char[] chars, int beginIndex, int limit, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns a LineMetrics object created with the specified arguments.
 LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics getLineMetrics sample code for java.awt.Font.getLineMetrics(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext) (CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator  ci, int beginIndex, int limit, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns a LineMetrics object created with the specified arguments.
 LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics getLineMetrics sample code for java.awt.Font.getLineMetrics(java.lang.String, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(java.lang.String, java.awt.font.FontRenderContext) (String sample code for java.lang.String definition code for java.lang.String  str, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns a LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics object created with the specified String and FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext .
 LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics getLineMetrics sample code for java.awt.Font.getLineMetrics(java.lang.String, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(java.lang.String, int, int, java.awt.font.FontRenderContext) (String sample code for java.lang.String definition code for java.lang.String  str, int beginIndex, int limit, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns a LineMetrics object created with the specified arguments.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getMaxCharBounds sample code for java.awt.Font.getMaxCharBounds(java.awt.font.FontRenderContext) definition code for java.awt.Font.getMaxCharBounds(java.awt.font.FontRenderContext) (FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns the bounds for the character with the maximum bounds as defined in the specified FontRenderContext.
 int getMissingGlyphCode sample code for java.awt.Font.getMissingGlyphCode() definition code for java.awt.Font.getMissingGlyphCode() ()
          Returns the glyphCode which is used when this Font does not have a glyph for a specified unicode.
 String sample code for java.lang.String definition code for java.lang.String getName sample code for java.awt.Font.getName() definition code for java.awt.Font.getName() ()
          Returns the logical name of this Font.
 int getNumGlyphs sample code for java.awt.Font.getNumGlyphs() definition code for java.awt.Font.getNumGlyphs() ()
          Returns the number of glyphs in this Font.
 FontPeer sample code for java.awt.peer.FontPeer definition code for java.awt.peer.FontPeer getPeer sample code for java.awt.Font.getPeer() definition code for java.awt.Font.getPeer() ()
          Deprecated. Font rendering is now platform independent.
 String sample code for java.lang.String definition code for java.lang.String getPSName sample code for java.awt.Font.getPSName() definition code for java.awt.Font.getPSName() ()
          Returns the postscript name of this Font.
 int getSize sample code for java.awt.Font.getSize() definition code for java.awt.Font.getSize() ()
          Returns the point size of this Font, rounded to an integer.
 float getSize2D sample code for java.awt.Font.getSize2D() definition code for java.awt.Font.getSize2D() ()
          Returns the point size of this Font in float value.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getStringBounds sample code for java.awt.Font.getStringBounds(char[], int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(char[], int, int, java.awt.font.FontRenderContext) (char[] chars, int beginIndex, int limit, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns the logical bounds of the specified array of characters in the specified FontRenderContext.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getStringBounds sample code for java.awt.Font.getStringBounds(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext) (CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator  ci, int beginIndex, int limit, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns the logical bounds of the characters indexed in the specified CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator in the specified FontRenderContext.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getStringBounds sample code for java.awt.Font.getStringBounds(java.lang.String, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(java.lang.String, java.awt.font.FontRenderContext) (String sample code for java.lang.String definition code for java.lang.String  str, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns the logical bounds of the specified String in the specified FontRenderContext.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getStringBounds sample code for java.awt.Font.getStringBounds(java.lang.String, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(java.lang.String, int, int, java.awt.font.FontRenderContext) (String sample code for java.lang.String definition code for java.lang.String  str, int beginIndex, int limit, FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
          Returns the logical bounds of the specified String in the specified FontRenderContext.
 int getStyle sample code for java.awt.Font.getStyle() definition code for java.awt.Font.getStyle() ()
          Returns the style of this Font.
 AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform getTransform sample code for java.awt.Font.getTransform() definition code for java.awt.Font.getTransform() ()
          Returns a copy of the transform associated with this Font.
 int hashCode sample code for java.awt.Font.hashCode() definition code for java.awt.Font.hashCode() ()
          Returns a hashcode for this Font.
 boolean hasUniformLineMetrics sample code for java.awt.Font.hasUniformLineMetrics() definition code for java.awt.Font.hasUniformLineMetrics() ()
          Checks whether or not this Font has uniform line metrics.
 boolean isBold sample code for java.awt.Font.isBold() definition code for java.awt.Font.isBold() ()
          Indicates whether or not this Font object's style is BOLD.
 boolean isItalic sample code for java.awt.Font.isItalic() definition code for java.awt.Font.isItalic() ()
          Indicates whether or not this Font object's style is ITALIC.
 boolean isPlain sample code for java.awt.Font.isPlain() definition code for java.awt.Font.isPlain() ()
          Indicates whether or not this Font object's style is PLAIN.
 boolean isTransformed sample code for java.awt.Font.isTransformed() definition code for java.awt.Font.isTransformed() ()
          Indicates whether or not this Font object has a transform that affects its size in addition to the Size attribute.
 GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector layoutGlyphVector sample code for java.awt.Font.layoutGlyphVector(java.awt.font.FontRenderContext, char[], int, int, int) definition code for java.awt.Font.layoutGlyphVector(java.awt.font.FontRenderContext, char[], int, int, int) (FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc, char[] text, int start, int limit, int flags)
          Returns a new GlyphVector object, performing full layout of the text if possible.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.awt.Font.toString() definition code for java.awt.Font.toString() ()
          Converts this Font object to a String representation.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

PLAIN sample code for java.awt.Font.PLAIN

public static final int PLAIN
The plain style constant.

See Also:
Constant Field Values

BOLD sample code for java.awt.Font.BOLD

public static final int BOLD
The bold style constant. This can be combined with the other style constants (except PLAIN) for mixed styles.

See Also:
Constant Field Values

ITALIC sample code for java.awt.Font.ITALIC

public static final int ITALIC
The italicized style constant. This can be combined with the other style constants (except PLAIN) for mixed styles.

See Also:
Constant Field Values

ROMAN_BASELINE sample code for java.awt.Font.ROMAN_BASELINE

public static final int ROMAN_BASELINE
The baseline used in most Roman scripts when laying out text.

See Also:
Constant Field Values

CENTER_BASELINE sample code for java.awt.Font.CENTER_BASELINE

public static final int CENTER_BASELINE
The baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text.

See Also:
Constant Field Values

HANGING_BASELINE sample code for java.awt.Font.HANGING_BASELINE

public static final int HANGING_BASELINE
The baseline used in Devanigiri and similar scripts when laying out text.

See Also:
Constant Field Values

TRUETYPE_FONT sample code for java.awt.Font.TRUETYPE_FONT

public static final int TRUETYPE_FONT
Identify a font resource of type TRUETYPE. Used to specify a TrueType font resource to the createFont(int, java.io.InputStream) sample code for java.awt.Font.createFont(int, java.io.InputStream) definition code for java.awt.Font.createFont(int, java.io.InputStream) method.

Since:
1.3
See Also:
Constant Field Values

TYPE1_FONT sample code for java.awt.Font.TYPE1_FONT

public static final int TYPE1_FONT
Identify a font resource of type TYPE1. Used to specify a Type1 font resource to the createFont(int, java.io.InputStream) sample code for java.awt.Font.createFont(int, java.io.InputStream) definition code for java.awt.Font.createFont(int, java.io.InputStream) method.

Since:
1.5
See Also:
Constant Field Values

name sample code for java.awt.Font.name

protected String sample code for java.lang.String definition code for java.lang.String  name
The logical name of this Font, as passed to the constructor.

Since:
JDK1.0
See Also:
getName() sample code for java.awt.Font.getName() definition code for java.awt.Font.getName()

style sample code for java.awt.Font.style

protected int style
The style of this Font, as passed to the constructor. This style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.

Since:
JDK1.0
See Also:
getStyle() sample code for java.awt.Font.getStyle() definition code for java.awt.Font.getStyle()

size sample code for java.awt.Font.size

protected int size
The point size of this Font, rounded to integer.

Since:
JDK1.0
See Also:
getSize() sample code for java.awt.Font.getSize() definition code for java.awt.Font.getSize()

pointSize sample code for java.awt.Font.pointSize

protected float pointSize
The point size of this Font in float.

See Also:
getSize() sample code for java.awt.Font.getSize() definition code for java.awt.Font.getSize() , getSize2D() sample code for java.awt.Font.getSize2D() definition code for java.awt.Font.getSize2D()

LAYOUT_LEFT_TO_RIGHT sample code for java.awt.Font.LAYOUT_LEFT_TO_RIGHT

public static final int LAYOUT_LEFT_TO_RIGHT
A flag to layoutGlyphVector indicating that text is left-to-right as determined by Bidi analysis.

See Also:
Constant Field Values

LAYOUT_RIGHT_TO_LEFT sample code for java.awt.Font.LAYOUT_RIGHT_TO_LEFT

public static final int LAYOUT_RIGHT_TO_LEFT
A flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis.

See Also:
Constant Field Values

LAYOUT_NO_START_CONTEXT sample code for java.awt.Font.LAYOUT_NO_START_CONTEXT

public static final int LAYOUT_NO_START_CONTEXT
A flag to layoutGlyphVector indicating that text in the char array before the indicated start should not be examined.

See Also:
Constant Field Values

LAYOUT_NO_LIMIT_CONTEXT sample code for java.awt.Font.LAYOUT_NO_LIMIT_CONTEXT

public static final int LAYOUT_NO_LIMIT_CONTEXT
A flag to layoutGlyphVector indicating that text in the char array after the indicated limit should not be examined.

See Also:
Constant Field Values
Constructor Detail

Font sample code for java.awt.Font(java.lang.String, int, int) definition code for java.awt.Font(java.lang.String, int, int)

public Font(String sample code for java.lang.String definition code for java.lang.String  name,
            int style,
            int size)
Creates a new Font from the specified name, style and point size.

The font name can be a font face name or a font family name. It is used together with the style to find an appropriate font face. When a font family name is specified, the style argument is used to select the most appropriate face from the family. When a font face name is specified, the face's style and the style argument are merged to locate the best matching font from the same family. For example if face name "Arial Bold" is specified with style Font.ITALIC, the font system looks for a face in the "Arial" family that is bold and italic, and may associate the font instance with the physical font face "Arial Bold Italic". The style argument is merged with the specified face's style, not added or subtracted. This means, specifying a bold face and a bold style does not double-embolden the font, and specifying a bold face and a plain style does not lighten the font.

If no face for the requested style can be found, the font system may apply algorithmic styling to achieve the desired style. For example, if ITALIC is requested, but no italic face is available, glyphs from the plain face may be algorithmically obliqued (slanted).

Font name lookup is case insensitive, using the case folding rules of the US locale.

Parameters:
name - the font name. This can be a font face name or a font family name, and may represent either a logical font or a physical font found in this GraphicsEnvironment. The family names for logical fonts are: Dialog, DialogInput, Monospaced, Serif, or SansSerif. If name is null, the logical font name of the new Font as returned by getName()is set to the name "Default".
style - the style constant for the Font The style argument is an integer bitmask that may be PLAIN, or a bitwise union of BOLD and/or ITALIC (for example, ITALIC or BOLD|ITALIC). If the style argument does not conform to one of the expected integer bitmasks then the style is set to PLAIN.
size - the point size of the Font
Since:
JDK1.0
See Also:
GraphicsEnvironment.getAllFonts() sample code for java.awt.GraphicsEnvironment.getAllFonts() definition code for java.awt.GraphicsEnvironment.getAllFonts() , GraphicsEnvironment.getAvailableFontFamilyNames() sample code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames() definition code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames()

Font sample code for java.awt.Font(java.util.Map<? extends java.text.AttributedCharacterIterator.Attribute, ?>) definition code for java.awt.Font(java.util.Map<? extends java.text.AttributedCharacterIterator.Attribute, ?>)

public Font(Map sample code for java.util.Map definition code for java.util.Map <? extends AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute ,?> attributes)
Creates a new Font with the specified attributes. This Font only recognizes keys defined in TextAttribute sample code for java.awt.font.TextAttribute definition code for java.awt.font.TextAttribute as attributes. If attributes is null, a new Font is initialized with default attributes.

Parameters:
attributes - the attributes to assign to the new Font, or null
Method Detail

getPeer sample code for java.awt.Font.getPeer() definition code for java.awt.Font.getPeer()

@Deprecated
public FontPeer sample code for java.awt.peer.FontPeer definition code for java.awt.peer.FontPeer  getPeer()
Deprecated. Font rendering is now platform independent.

Gets the peer of this Font.

Returns:
the peer of the Font.
Since:
JDK1.1

getFont sample code for java.awt.Font.getFont(java.util.Map<? extends java.text.AttributedCharacterIterator.Attribute, ?>) definition code for java.awt.Font.getFont(java.util.Map<? extends java.text.AttributedCharacterIterator.Attribute, ?>)

public static Font sample code for java.awt.Font definition code for java.awt.Font  getFont(Map sample code for java.util.Map definition code for java.util.Map <? extends AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute ,?> attributes)
Returns a Font appropriate to this attribute set.

Parameters:
attributes - the attributes to assign to the new Font
Returns:
a new Font created with the specified attributes
Since:
1.2
See Also:
TextAttribute sample code for java.awt.font.TextAttribute definition code for java.awt.font.TextAttribute

createFont sample code for java.awt.Font.createFont(int, java.io.InputStream) definition code for java.awt.Font.createFont(int, java.io.InputStream)

public static Font sample code for java.awt.Font definition code for java.awt.Font  createFont(int fontFormat,
                              InputStream sample code for java.io.InputStream definition code for java.io.InputStream  fontStream)
                       throws FontFormatException sample code for java.awt.FontFormatException definition code for java.awt.FontFormatException ,
                              IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns a new Font using the specified font type and input data. The new Font is created with a point size of 1 and style PLAIN sample code for java.awt.Font.PLAIN definition code for java.awt.Font.PLAIN . This base font can then be used with the deriveFont methods in this class to derive new Font objects with varying sizes, styles, transforms and font features. This method does not close the InputStream sample code for java.io.InputStream definition code for java.io.InputStream .

Parameters:
fontFormat - the type of the Font, which is TRUETYPE_FONT sample code for java.awt.Font.TRUETYPE_FONT definition code for java.awt.Font.TRUETYPE_FONT if a TrueType resource is specified. or TYPE1_FONT sample code for java.awt.Font.TYPE1_FONT definition code for java.awt.Font.TYPE1_FONT if a Type 1 resource is specified.
fontStream - an InputStream object representing the input data for the font.
Returns:
a new Font created with the specified font type.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if fontFormat is not TRUETYPE_FONTorTYPE1_FONT.
FontFormatException sample code for java.awt.FontFormatException definition code for java.awt.FontFormatException - if the fontStream data does not contain the required font tables for the specified format.
IOException sample code for java.io.IOException definition code for java.io.IOException - if the fontStream cannot be completely read.
Since:
1.3

createFont sample code for java.awt.Font.createFont(int, java.io.File) definition code for java.awt.Font.createFont(int, java.io.File)

public static Font sample code for java.awt.Font definition code for java.awt.Font  createFont(int fontFormat,
                              File sample code for java.io.File definition code for java.io.File  fontFile)
                       throws FontFormatException sample code for java.awt.FontFormatException definition code for java.awt.FontFormatException ,
                              IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns a new Font using the specified font type and the specified font file. The new Font is created with a point size of 1 and style PLAIN sample code for java.awt.Font.PLAIN definition code for java.awt.Font.PLAIN . This base font can then be used with the deriveFont methods in this class to derive new Font objects with varying sizes, styles, transforms and font features.

Parameters:
fontFormat - the type of the Font, which is TRUETYPE_FONT sample code for java.awt.Font.TRUETYPE_FONT definition code for java.awt.Font.TRUETYPE_FONT if a TrueType resource is specified or TYPE1_FONT sample code for java.awt.Font.TYPE1_FONT definition code for java.awt.Font.TYPE1_FONT if a Type 1 resource is specified. So long as the returned font, or its derived fonts are referenced the implementation may continue to access fontFile to retrieve font data. Thus the results are undefined if the file is changed, or becomes inaccessible.
fontFile - a File object representing the input data for the font.
Returns:
a new Font created with the specified font type.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if fontFormat is not TRUETYPE_FONTorTYPE1_FONT.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if fontFile is null.
IOException sample code for java.io.IOException definition code for java.io.IOException - if the fontFile cannot be read.
FontFormatException sample code for java.awt.FontFormatException definition code for java.awt.FontFormatException - if fontFile does not contain the required font tables for the specified format.
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if the executing code does not have permission to read from the file.
Since:
1.5

getTransform sample code for java.awt.Font.getTransform() definition code for java.awt.Font.getTransform()

public AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  getTransform()
Returns a copy of the transform associated with this Font.

Returns:
an AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform object representing the transform attribute of this Font object.

getFamily sample code for java.awt.Font.getFamily() definition code for java.awt.Font.getFamily()

public String sample code for java.lang.String definition code for java.lang.String  getFamily()
Returns the family name of this Font.

The family name of a font is font specific. Two fonts such as Helvetica Italic and Helvetica Bold have the same family name, Helvetica, whereas their font face names are Helvetica Bold and Helvetica Italic. The list of available family names may be obtained by using the GraphicsEnvironment.getAvailableFontFamilyNames() sample code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames() definition code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames() method.

Use getName to get the logical name of the font. Use getFontName to get the font face name of the font.

Returns:
a String that is the family name of this Font.
Since:
JDK1.1
See Also:
getName() sample code for java.awt.Font.getName() definition code for java.awt.Font.getName() , getFontName() sample code for java.awt.Font.getFontName() definition code for java.awt.Font.getFontName()

getFamily sample code for java.awt.Font.getFamily(java.util.Locale) definition code for java.awt.Font.getFamily(java.util.Locale)

public String sample code for java.lang.String definition code for java.lang.String  getFamily(Locale sample code for java.util.Locale definition code for java.util.Locale  l)
Returns the family name of this Font, localized for the specified locale.

The family name of a font is font specific. Two fonts such as Helvetica Italic and Helvetica Bold have the same family name, Helvetica, whereas their font face names are Helvetica Bold and Helvetica Italic. The list of available family names may be obtained by using the GraphicsEnvironment.getAvailableFontFamilyNames() sample code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames() definition code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames() method.

Use getFontName to get the font face name of the font.

Parameters:
l - locale for which to get the family name
Returns:
a String representing the family name of the font, localized for the specified locale.
Since:
1.2
See Also:
getFontName() sample code for java.awt.Font.getFontName() definition code for java.awt.Font.getFontName() , Locale sample code for java.util.Locale definition code for java.util.Locale

getPSName sample code for java.awt.Font.getPSName() definition code for java.awt.Font.getPSName()

public String sample code for java.lang.String definition code for java.lang.String  getPSName()
Returns the postscript name of this Font. Use getFamily to get the family name of the font. Use getFontName to get the font face name of the font.

Returns:
a String representing the postscript name of this Font.
Since:
1.2

getName sample code for java.awt.Font.getName() definition code for java.awt.Font.getName()

public String sample code for java.lang.String definition code for java.lang.String  getName()
Returns the logical name of this Font. Use getFamily to get the family name of the font. Use getFontName to get the font face name of the font.

Returns:
a String representing the logical name of this Font.
Since:
JDK1.0
See Also:
getFamily() sample code for java.awt.Font.getFamily() definition code for java.awt.Font.getFamily() , getFontName() sample code for java.awt.Font.getFontName() definition code for java.awt.Font.getFontName()

getFontName sample code for java.awt.Font.getFontName() definition code for java.awt.Font.getFontName()

public String sample code for java.lang.String definition code for java.lang.String  getFontName()
Returns the font face name of this Font. For example, Helvetica Bold could be returned as a font face name. Use getFamily to get the family name of the font. Use getName to get the logical name of the font.

Returns:
a String representing the font face name of this Font.
Since:
1.2
See Also:
getFamily() sample code for java.awt.Font.getFamily() definition code for java.awt.Font.getFamily() , getName() sample code for java.awt.Font.getName() definition code for java.awt.Font.getName()

getFontName sample code for java.awt.Font.getFontName(java.util.Locale) definition code for java.awt.Font.getFontName(java.util.Locale)

public String sample code for java.lang.String definition code for java.lang.String  getFontName(Locale sample code for java.util.Locale definition code for java.util.Locale  l)
Returns the font face name of the Font, localized for the specified locale. For example, Helvetica Fett could be returned as the font face name. Use getFamily to get the family name of the font.

Parameters:
l - a locale for which to get the font face name
Returns:
a String representing the font face name, localized for the specified locale.
See Also:
getFamily() sample code for java.awt.Font.getFamily() definition code for java.awt.Font.getFamily() , Locale sample code for java.util.Locale definition code for java.util.Locale

getStyle sample code for java.awt.Font.getStyle() definition code for java.awt.Font.getStyle()

public int getStyle()
Returns the style of this Font. The style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.

Returns:
the style of this Font
Since:
JDK1.0
See Also:
isPlain() sample code for java.awt.Font.isPlain() definition code for java.awt.Font.isPlain() , isBold() sample code for java.awt.Font.isBold() definition code for java.awt.Font.isBold() , isItalic() sample code for java.awt.Font.isItalic() definition code for java.awt.Font.isItalic()

getSize sample code for java.awt.Font.getSize() definition code for java.awt.Font.getSize()

public int getSize()
Returns the point size of this Font, rounded to an integer. Most users are familiar with the idea of using point size to specify the size of glyphs in a font. This point size defines a measurement between the baseline of one line to the baseline of the following line in a single spaced text document. The point size is based on typographic points, approximately 1/72 of an inch.

The Java(tm)2D API adopts the convention that one point is equivalent to one unit in user coordinates. When using a normalized transform for converting user space coordinates to device space coordinates 72 user space units equal 1 inch in device space. In this case one point is 1/72 of an inch.

Returns:
the point size of this Font in 1/72 of an inch units.
Since:
JDK1.0
See Also:
getSize2D() sample code for java.awt.Font.getSize2D() definition code for java.awt.Font.getSize2D() , GraphicsConfiguration.getDefaultTransform() sample code for java.awt.GraphicsConfiguration.getDefaultTransform() definition code for java.awt.GraphicsConfiguration.getDefaultTransform() , GraphicsConfiguration.getNormalizingTransform() sample code for java.awt.GraphicsConfiguration.getNormalizingTransform() definition code for java.awt.GraphicsConfiguration.getNormalizingTransform()

getSize2D sample code for java.awt.Font.getSize2D() definition code for java.awt.Font.getSize2D()

public float getSize2D()
Returns the point size of this Font in float value.

Returns:
the point size of this Font as a float value.
Since:
1.2
See Also:
getSize() sample code for java.awt.Font.getSize() definition code for java.awt.Font.getSize()

isPlain sample code for java.awt.Font.isPlain() definition code for java.awt.Font.isPlain()

public boolean isPlain()
Indicates whether or not this Font object's style is PLAIN.

Returns:
true if this Font has a PLAIN sytle; false otherwise.
Since:
JDK1.0
See Also:
getStyle() sample code for java.awt.Font.getStyle() definition code for java.awt.Font.getStyle()

isBold sample code for java.awt.Font.isBold() definition code for java.awt.Font.isBold()

public boolean isBold()
Indicates whether or not this Font object's style is BOLD.

Returns:
true if this Font object's style is BOLD; false otherwise.
Since:
JDK1.0
See Also:
getStyle() sample code for java.awt.Font.getStyle() definition code for java.awt.Font.getStyle()

isItalic sample code for java.awt.Font.isItalic() definition code for java.awt.Font.isItalic()

public boolean isItalic()
Indicates whether or not this Font object's style is ITALIC.

Returns:
true if this Font object's style is ITALIC; false otherwise.
Since:
JDK1.0
See Also:
getStyle() sample code for java.awt.Font.getStyle() definition code for java.awt.Font.getStyle()

isTransformed sample code for java.awt.Font.isTransformed() definition code for java.awt.Font.isTransformed()

public boolean isTransformed()
Indicates whether or not this Font object has a transform that affects its size in addition to the Size attribute.

Returns:
true if this Font object has a non-identity AffineTransform attribute. false otherwise.
Since:
1.4
See Also:
getTransform() sample code for java.awt.Font.getTransform() definition code for java.awt.Font.getTransform()

getFont sample code for java.awt.Font.getFont(java.lang.String) definition code for java.awt.Font.getFont(java.lang.String)

public static Font sample code for java.awt.Font definition code for java.awt.Font  getFont(String sample code for java.lang.String definition code for java.lang.String  nm)
Returns a Font object from the system properties list. nm is treated as the name of a system property to be obtained. The String value of this property is then interpreted as a Font object according to the specification of Font.decode(String) If the specified property is not found, null is returned instead.

Parameters:
nm - the property name
Returns:
a Font object that the property name describes, or null if no such property exists.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if nm is null.
Since:
1.2
See Also:
decode(String) sample code for java.awt.Font.decode(java.lang.String) definition code for java.awt.Font.decode(java.lang.String)

decode sample code for java.awt.Font.decode(java.lang.String) definition code for java.awt.Font.decode(java.lang.String)

public static Font sample code for java.awt.Font definition code for java.awt.Font  decode(String sample code for java.lang.String definition code for java.lang.String  str)
Returns the Font that the str argument describes. To ensure that this method returns the desired Font, format the str parameter in one of these ways

in which style is one of the four case-insensitive strings: "PLAIN", "BOLD", "BOLDITALIC", or "ITALIC", and pointsize is a positive decimal integer representation of the point size. For example, if you want a font that is Arial, bold, with a point size of 18, you would call this method with: "Arial-BOLD-18". This is equivalent to calling the Font constructor : new Font("Arial", Font.BOLD, 18); and the values are interpreted as specified by that constructor.

A valid trailing decimal field is always interpreted as the pointsize. Therefore a fontname containing a trailing decimal value should not be used in the fontname only form.

If a style name field is not one of the valid style strings, it is interpreted as part of the font name, and the default style is used.

Only one of ' ' or '-' may be used to separate fields in the input. The identified separator is the one closest to the end of the string which separates a valid pointsize, or a valid style name from the rest of the string. Null (empty) pointsize and style fields are treated as valid fields with the default value for that field.

Some font names may include the separator characters ' ' or '-'. If str is not formed with 3 components, e.g. such that style or pointsize fields are not present in str, and fontname also contains a character determined to be the separator character then these characters where they appear as intended to be part of fontname may instead be interpreted as separators so the font name may not be properly recognised.

The default size is 12 and the default style is PLAIN. If str does not specify a valid size, the returned Font has a size of 12. If str does not specify a valid style, the returned Font has a style of PLAIN. If you do not specify a valid font name in the str argument, this method will return a font with the family name "Dialog". To determine what font family names are available on your system, use the GraphicsEnvironment.getAvailableFontFamilyNames() sample code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames() definition code for java.awt.GraphicsEnvironment.getAvailableFontFamilyNames() method. If str is null, a new Font is returned with the family name "Dialog", a size of 12 and a PLAIN style.

Parameters:
str - the name of the font, or null
Returns:
the Font object that str describes, or a new default Font if str is null.
Since:
JDK1.1
See Also:
getFamily() sample code for java.awt.Font.getFamily() definition code for java.awt.Font.getFamily()

getFont sample code for java.awt.Font.getFont(java.lang.String, java.awt.Font) definition code for java.awt.Font.getFont(java.lang.String, java.awt.Font)

public static Font sample code for java.awt.Font definition code for java.awt.Font  getFont(String sample code for java.lang.String definition code for java.lang.String  nm,
                           Font sample code for java.awt.Font definition code for java.awt.Font  font)
Gets the specified Font from the system properties list. As in the getProperty method of System, the first argument is treated as the name of a system property to be obtained. The String value of this property is then interpreted as a Font object.

The property value should be one of the forms accepted by Font.decode(String) If the specified property is not found, the font argument is returned instead.

Parameters:
nm - the case-insensitive property name
font - a default Font to return if property nm is not defined
Returns:
the Font value of the property.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if nm is null.
See Also:
decode(String) sample code for java.awt.Font.decode(java.lang.String) definition code for java.awt.Font.decode(java.lang.String)

hashCode sample code for java.awt.Font.hashCode() definition code for java.awt.Font.hashCode()

public int hashCode()
Returns a hashcode for this Font.

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a hashcode value for this Font.
Since:
JDK1.0
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

equals sample code for java.awt.Font.equals(java.lang.Object) definition code for java.awt.Font.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Compares this Font object to the specified Object.

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
obj - the Object to compare
Returns:
true if the objects are the same or if the argument is a Font object describing the same font as this object; false otherwise.
Since:
JDK1.0
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

toString sample code for java.awt.Font.toString() definition code for java.awt.Font.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Converts this Font object to a String representation.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a String representation of this Font object.
Since:
JDK1.0

getNumGlyphs sample code for java.awt.Font.getNumGlyphs() definition code for java.awt.Font.getNumGlyphs()

public int getNumGlyphs()
Returns the number of glyphs in this Font. Glyph codes for this Font range from 0 to getNumGlyphs() - 1.

Returns:
the number of glyphs in this Font.
Since:
1.2

getMissingGlyphCode sample code for java.awt.Font.getMissingGlyphCode() definition code for java.awt.Font.getMissingGlyphCode()

public int getMissingGlyphCode()
Returns the glyphCode which is used when this Font does not have a glyph for a specified unicode.

Returns:
the glyphCode of this Font.
Since:
1.2

getBaselineFor sample code for java.awt.Font.getBaselineFor(char) definition code for java.awt.Font.getBaselineFor(char)

public byte getBaselineFor(char c)
Returns the baseline appropriate for displaying this character.

Large fonts can support different writing systems, and each system can use a different baseline. The character argument determines the writing system to use. Clients should not assume all characters use the same baseline.

Parameters:
c - a character used to identify the writing system
Returns:
the baseline appropriate for the specified character.
Since:
1.2
See Also:
LineMetrics.getBaselineOffsets() sample code for java.awt.font.LineMetrics.getBaselineOffsets() definition code for java.awt.font.LineMetrics.getBaselineOffsets() , ROMAN_BASELINE sample code for java.awt.Font.ROMAN_BASELINE definition code for java.awt.Font.ROMAN_BASELINE , CENTER_BASELINE sample code for java.awt.Font.CENTER_BASELINE definition code for java.awt.Font.CENTER_BASELINE , HANGING_BASELINE sample code for java.awt.Font.HANGING_BASELINE definition code for java.awt.Font.HANGING_BASELINE

getAttributes sample code for java.awt.Font.getAttributes() definition code for java.awt.Font.getAttributes()

public Map sample code for java.util.Map definition code for java.util.Map <TextAttribute sample code for java.awt.font.TextAttribute definition code for java.awt.font.TextAttribute ,?> getAttributes()
Returns a map of font attributes available in this Font. Attributes include things like ligatures and glyph substitution.

Returns:
the attributes map of this Font.

getAvailableAttributes sample code for java.awt.Font.getAvailableAttributes() definition code for java.awt.Font.getAvailableAttributes()

public AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute [] getAvailableAttributes()
Returns the keys of all the attributes supported by this Font. These attributes can be used to derive other fonts.

Returns:
an array containing the keys of all the attributes supported by this Font.
Since:
1.2

deriveFont sample code for java.awt.Font.deriveFont(int, float) definition code for java.awt.Font.deriveFont(int, float)

public Font sample code for java.awt.Font definition code for java.awt.Font  deriveFont(int style,
                       float size)
Creates a new Font object by replicating this Font object and applying a new style and size.

Parameters:
style - the style for the new Font
size - the size for the new Font
Returns:
a new Font object.
Since:
1.2

deriveFont sample code for java.awt.Font.deriveFont(int, java.awt.geom.AffineTransform) definition code for java.awt.Font.deriveFont(int, java.awt.geom.AffineTransform)

public Font sample code for java.awt.Font definition code for java.awt.Font  deriveFont(int style,
                       AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  trans)
Creates a new Font object by replicating this Font object and applying a new style and transform.

Parameters:
style - the style for the new Font
trans - the AffineTransform associated with the new Font
Returns:
a new Font object.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if trans is null
Since:
1.2

deriveFont sample code for java.awt.Font.deriveFont(float) definition code for java.awt.Font.deriveFont(float)

public Font sample code for java.awt.Font definition code for java.awt.Font  deriveFont(float size)
Creates a new Font object by replicating the current Font object and applying a new size to it.

Parameters:
size - the size for the new Font.
Returns:
a new Font object.
Since:
1.2

deriveFont sample code for java.awt.Font.deriveFont(java.awt.geom.AffineTransform) definition code for java.awt.Font.deriveFont(java.awt.geom.AffineTransform)

public Font sample code for java.awt.Font definition code for java.awt.Font  deriveFont(AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  trans)
Creates a new Font object by replicating the current Font object and applying a new transform to it.

Parameters:
trans - the AffineTransform associated with the new Font
Returns:
a new Font object.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if trans is null
Since:
1.2

deriveFont sample code for java.awt.Font.deriveFont(int) definition code for java.awt.Font.deriveFont(int)

public Font sample code for java.awt.Font definition code for java.awt.Font  deriveFont(int style)
Creates a new Font object by replicating the current Font object and applying a new style to it.

Parameters:
style - the style for the new Font
Returns:
a new Font object.
Since:
1.2

deriveFont sample code for java.awt.Font.deriveFont(java.util.Map<? extends java.text.AttributedCharacterIterator.Attribute, ?>) definition code for java.awt.Font.deriveFont(java.util.Map<? extends java.text.AttributedCharacterIterator.Attribute, ?>)

public Font sample code for java.awt.Font definition code for java.awt.Font  deriveFont(Map sample code for java.util.Map definition code for java.util.Map <? extends AttributedCharacterIterator.Attribute sample code for java.text.AttributedCharacterIterator.Attribute definition code for java.text.AttributedCharacterIterator.Attribute ,?> attributes)
Creates a new Font object by replicating the current Font object and applying a new set of font attributes to it.

Parameters:
attributes - a map of attributes enabled for the new Font
Returns:
a new Font object.
Since:
1.2

canDisplay sample code for java.awt.Font.canDisplay(char) definition code for java.awt.Font.canDisplay(char)

public boolean canDisplay(char c)
Checks if this Font has a glyph for the specified character.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the canDisplay(int) sample code for java.awt.Font.canDisplay(int) definition code for java.awt.Font.canDisplay(int) method or canDisplayUpTo methods.

Parameters:
c - the character for which a glyph is needed
Returns:
true if this Font has a glyph for this character; false otherwise.
Since:
1.2

canDisplay sample code for java.awt.Font.canDisplay(int) definition code for java.awt.Font.canDisplay(int)

public boolean canDisplay(int codePoint)
Checks if this Font has a glyph for the specified character.

Parameters:
codePoint - the character (Unicode code point) for which a glyph is needed.
Returns:
true if this Font has a glyph for the character; false otherwise.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the code point is not a valid Unicode code point.
Since:
1.5
See Also:
Character.isValidCodePoint(int) sample code for java.lang.Character.isValidCodePoint(int) definition code for java.lang.Character.isValidCodePoint(int)

canDisplayUpTo sample code for java.awt.Font.canDisplayUpTo(java.lang.String) definition code for java.awt.Font.canDisplayUpTo(java.lang.String)

public int canDisplayUpTo(String sample code for java.lang.String definition code for java.lang.String  str)
Indicates whether or not this Font can display a specified String. For strings with Unicode encoding, it is important to know if a particular font can display the string. This method returns an offset into the String str which is the first character this Font cannot display without using the missing glyph code. If the Font can display all characters, -1 is returned.

Parameters:
str - a String object
Returns:
an offset into str that points to the first character in str that this Font cannot display; or -1 if this Font can display all characters in str.
Since:
1.2

canDisplayUpTo sample code for java.awt.Font.canDisplayUpTo(char[], int, int) definition code for java.awt.Font.canDisplayUpTo(char[], int, int)

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. This method is a convenience overload.

Parameters:
text - the specified array of char values
start - the specified starting offset (in chars) into the specified array of char values
limit - the specified ending offset (in chars) into the specified array of char values
Returns:
an offset into text that points to the first character in text that this Font cannot display; or -1 if this Font can display all characters in text.
Since:
1.2

canDisplayUpTo sample code for java.awt.Font.canDisplayUpTo(java.text.CharacterIterator, int, int) definition code for java.awt.Font.canDisplayUpTo(java.text.CharacterIterator, int, int)

public int canDisplayUpTo(CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.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.

Parameters:
iter - a CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator object
start - the specified starting offset into the specified CharacterIterator.
limit - the specified ending offset into the specified CharacterIterator.
Returns:
an offset into iter that points to the first character in iter that this Font cannot display; or -1 if this Font can display all characters in iter.
Since:
1.2

getItalicAngle sample code for java.awt.Font.getItalicAngle() definition code for java.awt.Font.getItalicAngle()

public float getItalicAngle()
Returns the italic angle of this Font. The italic angle is the inverse slope of the caret which best matches the posture of this Font.

Returns:
the angle of the ITALIC style of this Font.
See Also:
TextAttribute.POSTURE sample code for java.awt.font.TextAttribute.POSTURE definition code for java.awt.font.TextAttribute.POSTURE

hasUniformLineMetrics sample code for java.awt.Font.hasUniformLineMetrics() definition code for java.awt.Font.hasUniformLineMetrics()

public boolean hasUniformLineMetrics()
Checks whether or not this Font has uniform line metrics. A logical Font might be a composite font, which means that it is composed of different physical fonts to cover different code ranges. Each of these fonts might have different LineMetrics. If the logical Font is a single font then the metrics would be uniform.

Returns:
true if this Font has uniform line metrics; false otherwise.

getLineMetrics sample code for java.awt.Font.getLineMetrics(java.lang.String, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(java.lang.String, java.awt.font.FontRenderContext)

public LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics  getLineMetrics(String sample code for java.lang.String definition code for java.lang.String  str,
                                  FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns a LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics object created with the specified String and FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext .

Parameters:
str - the specified String
frc - the specified FontRenderContext
Returns:
a LineMetrics object created with the specified String and FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext .

getLineMetrics sample code for java.awt.Font.getLineMetrics(java.lang.String, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(java.lang.String, int, int, java.awt.font.FontRenderContext)

public LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics  getLineMetrics(String sample code for java.lang.String definition code for java.lang.String  str,
                                  int beginIndex,
                                  int limit,
                                  FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns a LineMetrics object created with the specified arguments.

Parameters:
str - the specified String
beginIndex - the initial offset of str
limit - the end offset of str
frc - the specified FontRenderContext
Returns:
a LineMetrics object created with the specified arguments.

getLineMetrics sample code for java.awt.Font.getLineMetrics(char[], int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(char[], int, int, java.awt.font.FontRenderContext)

public LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics  getLineMetrics(char[] chars,
                                  int beginIndex,
                                  int limit,
                                  FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns a LineMetrics object created with the specified arguments.

Parameters:
chars - an array of characters
beginIndex - the initial offset of chars
limit - the end offset of chars
frc - the specified FontRenderContext
Returns:
a LineMetrics object created with the specified arguments.

getLineMetrics sample code for java.awt.Font.getLineMetrics(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getLineMetrics(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext)

public LineMetrics sample code for java.awt.font.LineMetrics definition code for java.awt.font.LineMetrics  getLineMetrics(CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator  ci,
                                  int beginIndex,
                                  int limit,
                                  FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns a LineMetrics object created with the specified arguments.

Parameters:
ci - the specified CharacterIterator
beginIndex - the initial offset in ci
limit - the end offset of ci
frc - the specified FontRenderContext
Returns:
a LineMetrics object created with the specified arguments.

getStringBounds sample code for java.awt.Font.getStringBounds(java.lang.String, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(java.lang.String, java.awt.font.FontRenderContext)

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getStringBounds(String sample code for java.lang.String definition code for java.lang.String  str,
                                   FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns the logical bounds of the specified String in the specified FontRenderContext. The logical bounds contains the origin, ascent, advance, and height, which includes the leading. The logical bounds does not always enclose all the text. For example, in some languages and in some fonts, accent marks can be positioned above the ascent or below the descent. To obtain a visual bounding box, which encloses all the text, use the getBounds sample code for java.awt.font.TextLayout.getBounds() definition code for java.awt.font.TextLayout.getBounds() method of TextLayout.

Parameters:
str - the specified String
frc - the specified FontRenderContext
Returns:
a Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D that is the bounding box of the specified String in the specified FontRenderContext.
Since:
1.2
See Also:
FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext , createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)

getStringBounds sample code for java.awt.Font.getStringBounds(java.lang.String, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(java.lang.String, int, int, java.awt.font.FontRenderContext)

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getStringBounds(String sample code for java.lang.String definition code for java.lang.String  str,
                                   int beginIndex,
                                   int limit,
                                   FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns the logical bounds of the specified String in the specified FontRenderContext. The logical bounds contains the origin, ascent, advance, and height, which includes the leading. The logical bounds does not always enclose all the text. For example, in some languages and in some fonts, accent marks can be positioned above the ascent or below the descent. To obtain a visual bounding box, which encloses all the text, use the getBounds sample code for java.awt.font.TextLayout.getBounds() definition code for java.awt.font.TextLayout.getBounds() method of TextLayout.

Parameters:
str - the specified String
beginIndex - the initial offset of str
limit - the end offset of str
frc - the specified FontRenderContext
Returns:
a Rectangle2D that is the bounding box of the specified String in the specified FontRenderContext.
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if beginIndex is less than zero, or limit is greater than the length of str, or beginIndex is greater than limit.
Since:
1.2
See Also:
FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext , createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)

getStringBounds sample code for java.awt.Font.getStringBounds(char[], int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(char[], int, int, java.awt.font.FontRenderContext)

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getStringBounds(char[] chars,
                                   int beginIndex,
                                   int limit,
                                   FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns the logical bounds of the specified array of characters in the specified FontRenderContext. The logical bounds contains the origin, ascent, advance, and height, which includes the leading. The logical bounds does not always enclose all the text. For example, in some languages and in some fonts, accent marks can be positioned above the ascent or below the descent. To obtain a visual bounding box, which encloses all the text, use the getBounds sample code for java.awt.font.TextLayout.getBounds() definition code for java.awt.font.TextLayout.getBounds() method of TextLayout.

Parameters:
chars - an array of characters
beginIndex - the initial offset in the array of characters
limit - the end offset in the array of characters
frc - the specified FontRenderContext
Returns:
a Rectangle2D that is the bounding box of the specified array of characters in the specified FontRenderContext.
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if beginIndex is less than zero, or limit is greater than the length of chars, or beginIndex is greater than limit.
Since:
1.2
See Also:
FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext , createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)

getStringBounds sample code for java.awt.Font.getStringBounds(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext) definition code for java.awt.Font.getStringBounds(java.text.CharacterIterator, int, int, java.awt.font.FontRenderContext)

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getStringBounds(CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator  ci,
                                   int beginIndex,
                                   int limit,
                                   FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns the logical bounds of the characters indexed in the specified CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator in the specified FontRenderContext. The logical bounds contains the origin, ascent, advance, and height, which includes the leading. The logical bounds does not always enclose all the text. For example, in some languages and in some fonts, accent marks can be positioned above the ascent or below the descent. To obtain a visual bounding box, which encloses all the text, use the getBounds sample code for java.awt.font.TextLayout.getBounds() definition code for java.awt.font.TextLayout.getBounds() method of TextLayout.

Parameters:
ci - the specified CharacterIterator
beginIndex - the initial offset in ci
limit - the end offset in ci
frc - the specified FontRenderContext
Returns:
a Rectangle2D that is the bounding box of the characters indexed in the specified CharacterIterator in the specified FontRenderContext.
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if beginIndex is less than the start index of ci, or limit is greater than the end index of ci, or beginIndex is greater than limit
Since:
1.2
See Also:
FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext , createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)

getMaxCharBounds sample code for java.awt.Font.getMaxCharBounds(java.awt.font.FontRenderContext) definition code for java.awt.Font.getMaxCharBounds(java.awt.font.FontRenderContext)

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getMaxCharBounds(FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc)
Returns the bounds for the character with the maximum bounds as defined in the specified FontRenderContext.

Parameters:
frc - the specified FontRenderContext
Returns:
a Rectangle2D that is the bounding box for the character with the maximum bounds.

createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)

public GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector  createGlyphVector(FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc,
                                     String sample code for java.lang.String definition code for java.lang.String  str)
Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font. This method does no other processing besides the mapping of glyphs to characters. This means that this method is not useful for some scripts, such as Arabic, Hebrew, Thai, and Indic, that require reordering, shaping, or ligature substitution.

Parameters:
frc - the specified FontRenderContext
str - the specified String
Returns:
a new GlyphVector created with the specified String and the specified FontRenderContext.

createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, char[]) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, char[])

public GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector  createGlyphVector(FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc,
                                     char[] chars)
Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font. This method does no other processing besides the mapping of glyphs to characters. This means that this method is not useful for some scripts, such as Arabic, Hebrew, Thai, and Indic, that require reordering, shaping, or ligature substitution.

Parameters:
frc - the specified FontRenderContext
chars - the specified array of characters
Returns:
a new GlyphVector created with the specified array of characters and the specified FontRenderContext.

createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.text.CharacterIterator) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, java.text.CharacterIterator)

public GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector  createGlyphVector(FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc,
                                     CharacterIterator sample code for java.text.CharacterIterator definition code for java.text.CharacterIterator  ci)
Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping the specified characters to glyphs one-to-one based on the Unicode cmap in this Font. This method does no other processing besides the mapping of glyphs to characters. This means that this method is not useful for some scripts, such as Arabic, Hebrew, Thai, and Indic, that require reordering, shaping, or ligature substitution.

Parameters:
frc - the specified FontRenderContext
ci - the specified CharacterIterator
Returns:
a new GlyphVector created with the specified CharacterIterator and the specified FontRenderContext.

createGlyphVector sample code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, int[]) definition code for java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, int[])

public GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector  createGlyphVector(FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc,
                                     int[] glyphCodes)
Creates a GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font. This method does no other processing besides the mapping of glyphs to characters. This means that this method is not useful for some scripts, such as Arabic, Hebrew, Thai, and Indic, that require reordering, shaping, or ligature substitution.

Parameters:
frc - the specified FontRenderContext
glyphCodes - the specified integer array
Returns:
a new GlyphVector created with the specified integer array and the specified FontRenderContext.

layoutGlyphVector sample code for java.awt.Font.layoutGlyphVector(java.awt.font.FontRenderContext, char[], int, int, int) definition code for java.awt.Font.layoutGlyphVector(java.awt.font.FontRenderContext, char[], int, int, int)

public GlyphVector sample code for java.awt.font.GlyphVector definition code for java.awt.font.GlyphVector  layoutGlyphVector(FontRenderContext sample code for java.awt.font.FontRenderContext definition code for java.awt.font.FontRenderContext  frc,
                                     char[] text,
                                     int start,
                                     int limit,
                                     int flags)
Returns a new GlyphVector object, performing full layout of the text if possible. Full layout is required for complex text, such as Arabic or Hindi. Support for different scripts depends on the font and implementation.

Bidi, and should only be performed on text that has a uniform direction. The direction is indicated in the flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a right-to-left (Arabic and Hebrew) run direction, or LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) run direction.

In addition, some operations, such as Arabic shaping, require context, so that the characters at the start and limit can have the proper shapes. Sometimes the data in the buffer outside the provided range does not have valid data. The values LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be added to the flags parameter to indicate that the text before start, or after limit, respectively, should not be examined for context.

All other values for the flags parameter are reserved.

Parameters:
frc - the specified FontRenderContext
text - the text to layout
start - the start of the text to use for the GlyphVector
limit - the limit of the text to use for the GlyphVector
flags - control flags as described above
Returns:
a new GlyphVector representing the text between start and limit, with glyphs chosen and positioned so as to best represent the text
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if start or limit is out of bounds
See Also:
Bidi sample code for java.text.Bidi definition code for java.text.Bidi , LAYOUT_LEFT_TO_RIGHT sample code for java.awt.Font.LAYOUT_LEFT_TO_RIGHT definition code for java.awt.Font.LAYOUT_LEFT_TO_RIGHT , LAYOUT_RIGHT_TO_LEFT sample code for java.awt.Font.LAYOUT_RIGHT_TO_LEFT definition code for java.awt.Font.LAYOUT_RIGHT_TO_LEFT , LAYOUT_NO_START_CONTEXT sample code for java.awt.Font.LAYOUT_NO_START_CONTEXT definition code for java.awt.Font.LAYOUT_NO_START_CONTEXT , LAYOUT_NO_LIMIT_CONTEXT sample code for java.awt.Font.LAYOUT_NO_LIMIT_CONTEXT definition code for java.awt.Font.LAYOUT_NO_LIMIT_CONTEXT

finalize sample code for java.awt.Font.finalize() definition code for java.awt.Font.finalize()

protected void finalize()
                 throws Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable 
Disposes the native Font object.

Overrides:
finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() in class Object sample code for java.lang.Object definition code for java.lang.Object
Throws:
Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable - the Exception raised by this method