Java Doc for Font.java in  » 6.0-JDK-Core » AWT » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.Font

Font
public class Font implements java.io.Serializable(Code)
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 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 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 Font.createFont createFont 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 Label and TextField 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 GraphicsEnvironment.getAllFonts 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.

Font and TextAttribute

Font supports most TextAttributes. This makes some operations, such as rendering underlined text, convenient since it is not necessary to explicitly construct a TextLayout object. Attributes can be set on a Font by constructing or deriving it using a Map of TextAttribute values.

The values of some TextAttributes are not serializable, and therefore attempting to serialize an instance of Font that has such values will not serialize them. This means a Font deserialized from such a stream will not compare equal to the original Font that contained the non-serializable attributes. This should very rarely pose a problem since these attributes are typically used only in special circumstances and are unlikely to be serialized.

  • FOREGROUND and BACKGROUND use Paint values. The subclass Color is serializable, while GradientPaint and TexturePaint are not.
  • CHAR_REPLACEMENT uses GraphicAttribute values. The subclasses ShapeGraphicAttribute and ImageGraphicAttribute are not serializable.
  • INPUT_METHOD_HIGHLIGHT uses InputMethodHighlight values, which are not serializable. See java.awt.im.InputMethodHighlight .
Clients who create custom subclasses of Paint and GraphicAttribute can make them serializable and avoid this problem. Clients who use input method highlights can convert these to the platform-specific attributes for that highlight on the current platform and set them on the Font as a workaround.

The Map-based constructor and deriveFont APIs ignore the FONT attribute, and it is not retained by the Font; the static Font.getFont method should be used if the FONT attribute might be present. See java.awt.font.TextAttribute.FONT for more information.

Several attributes will cause additional rendering overhead and potentially invoke layout. If a Font has such attributes, the Font.hasLayoutAttributes() method will return true.

Note: Font rotations can cause text baselines to be rotated. In order to account for this (rare) possibility, font APIs are specified to return metrics and take parameters 'in baseline-relative coordinates'. This maps the 'x' coordinate to the advance along the baseline, (positive x is forward along the baseline), and the 'y' coordinate to a distance along the perpendicular to the baseline at 'x' (positive y is 90 degrees clockwise from the baseline vector). APIs for which this is especially important are called out as having 'baseline-relative coordinates.'



Field Summary
final public static  intBOLD
     The bold style constant.
final public static  intCENTER_BASELINE
     The baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text.
final public static  StringDIALOG
     A String constant for the canonical family name of the logical font "Dialog".
final public static  StringDIALOG_INPUT
     A String constant for the canonical family name of the logical font "DialogInput".
final public static  intHANGING_BASELINE
     The baseline used in Devanigiri and similar scripts when laying out text.
final public static  intITALIC
     The italicized style constant.
final public static  intLAYOUT_LEFT_TO_RIGHT
     A flag to layoutGlyphVector indicating that text is left-to-right as determined by Bidi analysis.
final public static  intLAYOUT_NO_LIMIT_CONTEXT
     A flag to layoutGlyphVector indicating that text in the char array after the indicated limit should not be examined.
final public static  intLAYOUT_NO_START_CONTEXT
     A flag to layoutGlyphVector indicating that text in the char array before the indicated start should not be examined.
final public static  intLAYOUT_RIGHT_TO_LEFT
     A flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis.
final public static  StringMONOSPACED
     A String constant for the canonical family name of the logical font "Monospaced".
final public static  intPLAIN
     The plain style constant.
final public static  intROMAN_BASELINE
     The baseline used in most Roman scripts when laying out text.
final public static  StringSANS_SERIF
     A String constant for the canonical family name of the logical font "SansSerif".
final public static  StringSERIF
     A String constant for the canonical family name of the logical font "Serif".
final public static  intTRUETYPE_FONT
     Identify a font resource of type TRUETYPE.
final public static  intTYPE1_FONT
     Identify a font resource of type TYPE1.
transient  inthash
    
protected  Stringname
     The logical name of this Font, as passed to the constructor.
protected  floatpointSize
     The point size of this Font in float.
protected  intsize
     The point size of this Font, rounded to integer.
protected  intstyle
     The style of this Font, as passed to the constructor.

Constructor Summary
public  Font(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.

public  Font(Map<? extends Attribute, ?> attributes)
     Creates a new Font with the specified attributes. Only keys defined in java.awt.font.TextAttribute TextAttribute are recognized.
protected  Font(Font font)
     Creates a new Font from the specified font.

Method Summary
public  booleancanDisplay(char c)
     Checks if this Font has a glyph for the specified character.

Note: This method cannot handle supplementary characters.

public  booleancanDisplay(int codePoint)
     Checks if this Font has a glyph for the specified character.
Parameters:
  codePoint - the character (Unicode code point) for which a glyphis needed.
public  intcanDisplayUpTo(String str)
     Indicates whether or not this Font can display a specified String.
public  intcanDisplayUpTo(char[] text, int start, int limit)
     Indicates whether or not this Font can display the characters in the specified text starting at start and ending at limit.
public  intcanDisplayUpTo(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 object
Parameters:
  start - the specified starting offset into the specifiedCharacterIterator.
Parameters:
  limit - the specified ending offset into the specifiedCharacterIterator.
public static  FontcreateFont(int fontFormat, InputStream fontStream)
     Returns a new Font using the specified font type and input data.
public static  FontcreateFont(int fontFormat, File fontFile)
     Returns a new Font using the specified font type and the specified font file.
public  GlyphVectorcreateGlyphVector(FontRenderContext frc, String str)
     Creates a java.awt.font.GlyphVector GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
public  GlyphVectorcreateGlyphVector(FontRenderContext frc, char[] chars)
     Creates a java.awt.font.GlyphVector GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
public  GlyphVectorcreateGlyphVector(FontRenderContext frc, CharacterIterator ci)
     Creates a java.awt.font.GlyphVector GlyphVector by mapping the specified characters to glyphs one-to-one based on the Unicode cmap in this Font.
public  GlyphVectorcreateGlyphVector(FontRenderContext frc, int[] glyphCodes)
     Creates a java.awt.font.GlyphVector GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font.
public static  Fontdecode(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

  • fontname-style-pointsize
  • fontname-pointsize
  • fontname-style
  • fontname
  • fontname style pointsize
  • fontname pointsize
  • fontname style
  • fontname
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.

public  FontderiveFont(int style, float size)
     Creates a new Font object by replicating this Font object and applying a new style and size.
public  FontderiveFont(int style, AffineTransform trans)
     Creates a new Font object by replicating this Font object and applying a new style and transform.
public  FontderiveFont(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.
public  FontderiveFont(AffineTransform trans)
     Creates a new Font object by replicating the current Font object and applying a new transform to it.
public  FontderiveFont(int style)
     Creates a new Font object by replicating the current Font object and applying a new style to it.
public  FontderiveFont(Map<? extends Attribute, ?> attributes)
     Creates a new Font object by replicating the current Font object and applying a new set of font attributes to it.
public  booleanequals(Object obj)
     Compares this Font object to the specified Object.
public  Map<TextAttribute, ?>getAttributes()
     Returns a map of font attributes available in this Font.
public  Attribute[]getAvailableAttributes()
     Returns the keys of all the attributes supported by this Font.
public  bytegetBaselineFor(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.

public  StringgetFamily()
     Returns the family name of this Font.
public  StringgetFamily(Locale l)
     Returns the family name of this Font, localized for the specified locale.

The family name of a font is font specific.

final  StringgetFamily_NoClientCode()
    
public static  FontgetFont(Map<? extends Attribute, ?> attributes)
     Returns a Font appropriate to the attributes. If attributescontains a FONT attribute with a valid Font as its value, it will be merged with any remaining attributes.
public static  FontgetFont(String nm)
     Returns a Font object from the system properties list. nm is treated as the name of a system property to be obtained.
public static  FontgetFont(String nm, Font font)
     Gets the specified Font from the system properties list.
public  StringgetFontName()
     Returns the font face name of this Font.
public  StringgetFontName(Locale l)
     Returns the font face name of the Font, localized for the specified locale.
public  floatgetItalicAngle()
     Returns the italic angle of this Font.
public  LineMetricsgetLineMetrics(String str, FontRenderContext frc)
     Returns a LineMetrics object created with the specified String and FontRenderContext .
public  LineMetricsgetLineMetrics(String str, int beginIndex, int limit, FontRenderContext frc)
     Returns a LineMetrics object created with the specified arguments.
public  LineMetricsgetLineMetrics(char[] chars, int beginIndex, int limit, FontRenderContext frc)
     Returns a LineMetrics object created with the specified arguments.
public  LineMetricsgetLineMetrics(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)
     Returns a LineMetrics object created with the specified arguments.
public  Rectangle2DgetMaxCharBounds(FontRenderContext frc)
     Returns the bounds for the character with the maximum bounds as defined in the specified FontRenderContext.
public  intgetMissingGlyphCode()
     Returns the glyphCode which is used when this Font does not have a glyph for a specified unicode code point.
public  StringgetName()
     Returns the logical name of this Font.
public  intgetNumGlyphs()
     Returns the number of glyphs in this Font.
public  StringgetPSName()
     Returns the postscript name of this Font.
public  FontPeergetPeer()
     Gets the peer of this Font.
final  FontPeergetPeer_NoClientCode()
    
public  intgetSize()
     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.
public  floatgetSize2D()
     Returns the point size of this Font in float value.
public  Rectangle2DgetStringBounds(String str, FontRenderContext frc)
     Returns the logical bounds of the specified String in the specified FontRenderContext.
public  Rectangle2DgetStringBounds(String str, int beginIndex, int limit, FontRenderContext frc)
     Returns the logical bounds of the specified String in the specified FontRenderContext.
public  Rectangle2DgetStringBounds(char[] chars, int beginIndex, int limit, FontRenderContext frc)
     Returns the logical bounds of the specified array of characters in the specified FontRenderContext.
public  Rectangle2DgetStringBounds(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)
     Returns the logical bounds of the characters indexed in the specified CharacterIterator in the specified FontRenderContext.
public  intgetStyle()
     Returns the style of this Font.
public  AffineTransformgetTransform()
     Returns a copy of the transform associated with this Font.
public  booleanhasLayoutAttributes()
     Return true if this Font contains attributes that require extra layout processing.
public  booleanhasUniformLineMetrics()
     Checks whether or not this Font has uniform line metrics.
public  inthashCode()
     Returns a hashcode for this Font.
public  booleanisBold()
     Indicates whether or not this Font object's style is BOLD.
public  booleanisItalic()
     Indicates whether or not this Font object's style is ITALIC.
public  booleanisPlain()
     Indicates whether or not this Font object's style is PLAIN.
public  booleanisTransformed()
     Indicates whether or not this Font object has a transform that affects its size in addition to the Size attribute.
public  GlyphVectorlayoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags)
     Returns a new GlyphVector object, performing full layout of the text if possible.
public  StringtoString()
     Converts this Font object to a String representation.

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



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



DIALOG
final public static String DIALOG(Code)
A String constant for the canonical family name of the logical font "Dialog". It is useful in Font construction to provide compile-time verification of the name.
since:
   1.6



DIALOG_INPUT
final public static String DIALOG_INPUT(Code)
A String constant for the canonical family name of the logical font "DialogInput". It is useful in Font construction to provide compile-time verification of the name.
since:
   1.6



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



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



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



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



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



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



MONOSPACED
final public static String MONOSPACED(Code)
A String constant for the canonical family name of the logical font "Monospaced". It is useful in Font construction to provide compile-time verification of the name.
since:
   1.6



PLAIN
final public static int PLAIN(Code)
The plain style constant.



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



SANS_SERIF
final public static String SANS_SERIF(Code)
A String constant for the canonical family name of the logical font "SansSerif". It is useful in Font construction to provide compile-time verification of the name.
since:
   1.6



SERIF
final public static String SERIF(Code)
A String constant for the canonical family name of the logical font "Serif". It is useful in Font construction to provide compile-time verification of the name.
since:
   1.6



TRUETYPE_FONT
final public static int TRUETYPE_FONT(Code)
Identify a font resource of type TRUETYPE. Used to specify a TrueType font resource to the Font.createFont method.
since:
   1.3



TYPE1_FONT
final public static int TYPE1_FONT(Code)
Identify a font resource of type TYPE1. Used to specify a Type1 font resource to the Font.createFont method.
since:
   1.5



hash
transient int hash(Code)



name
protected String name(Code)
The logical name of this Font, as passed to the constructor.
since:
   JDK1.0
See Also:   Font.getName



pointSize
protected float pointSize(Code)
The point size of this Font in float.
See Also:   Font.getSize()
See Also:   Font.getSize2D()



size
protected int size(Code)
The point size of this Font, rounded to integer.
since:
   JDK1.0
See Also:   Font.getSize()



style
protected int style(Code)
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:   Font.getStyle()




Constructor Detail
Font
public Font(String name, int style, int size)(Code)
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.

If the name parameter represents something other than a logical font, i.e. is interpreted as a physical font face or family, and this cannot be mapped by the implementation to a physical font or a compatible alternative, then the font system will map the Font instance to "Dialog", such that for example, the family as reported by Font.getFamily() getFamily will be "Dialog".


Parameters:
  name - the font name. This can be a font face name or a fontfamily name, and may represent either a logical font or a physicalfont found in this GraphicsEnvironment .The family names for logical fonts are: Dialog, DialogInput,Monospaced, Serif, or SansSerif. Pre-defined String constants existfor all of these names, for example, DIALOG . If name is null , the logical font name of the new Font as returned by getName() is set tothe name "Default".
Parameters:
  style - the style constant for the Font The style argument is an integer bitmask that maybe 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 expectedinteger bitmasks then the style is set to PLAIN .
Parameters:
  size - the point size of the Font
See Also:   GraphicsEnvironment.getAllFonts
See Also:   GraphicsEnvironment.getAvailableFontFamilyNames
since:
   JDK1.0




Font
public Font(Map<? extends Attribute, ?> attributes)(Code)
Creates a new Font with the specified attributes. Only keys defined in java.awt.font.TextAttribute TextAttribute are recognized. In addition the FONT attribute is not recognized by this constructor (see Font.getAvailableAttributes ). Only attributes that have values of valid types will affect the new Font.

If attributes is null, a new Font is initialized with default values.
See Also:   java.awt.font.TextAttribute
Parameters:
  attributes - the attributes to assign to the newFont, or null




Font
protected Font(Font font)(Code)
Creates a new Font from the specified font. This constructor is intended for use by subclasses.
Parameters:
  font - from which to create this Font.
throws:
  NullPointerException - if font is null
since:
   1.6




Method Detail
canDisplay
public boolean canDisplay(char c)(Code)
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 Font.canDisplay(int) method or canDisplayUpTo methods.
Parameters:
  c - the character for which a glyph is needed true if this Font has a glyph for thischaracter; false otherwise.
since:
   1.2




canDisplay
public boolean canDisplay(int codePoint)(Code)
Checks if this Font has a glyph for the specified character.
Parameters:
  codePoint - the character (Unicode code point) for which a glyphis needed. true if this Font has a glyph for thecharacter; false otherwise.
throws:
  IllegalArgumentException - if the code point is not a valid Unicodecode point.
See Also:   Character.isValidCodePoint(int)
since:
   1.5



canDisplayUpTo
public int canDisplayUpTo(String str)(Code)
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 an offset into str that pointsto the first character in str that thisFont cannot display; or -1 ifthis Font can display all characters instr.
since:
   1.2



canDisplayUpTo
public int canDisplayUpTo(char[] text, int start, int limit)(Code)
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
Parameters:
  start - the specified starting offset (inchars) into the specified array ofchar values
Parameters:
  limit - the specified ending offset (inchars) into the specified array ofchar values an offset into text that pointsto the first character in text that thisFont cannot display; or -1 ifthis Font can display all characters intext.
since:
   1.2



canDisplayUpTo
public int canDisplayUpTo(CharacterIterator iter, int start, int limit)(Code)
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 object
Parameters:
  start - the specified starting offset into the specifiedCharacterIterator.
Parameters:
  limit - the specified ending offset into the specifiedCharacterIterator. an offset into iter that pointsto the first character in iter that thisFont cannot display; or -1 ifthis Font can display all characters initer.
since:
   1.2



createFont
public static Font createFont(int fontFormat, InputStream fontStream) throws java.awt.FontFormatException, java.io.IOException(Code)
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 Font.PLAIN 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 .

To make the Font available to Font constructors the returned Font must be registered in the GraphicsEnviroment by calling GraphicsEnvironment.registerFont(Font) registerFont(Font) .
Parameters:
  fontFormat - the type of the Font, which isFont.TRUETYPE_FONT TRUETYPE_FONT if a TrueType resource is specified.or Font.TYPE1_FONT TYPE1_FONT if a Type 1 resource is specified.
Parameters:
  fontStream - an InputStream object representing theinput data for the font. a new Font created with the specified font type.
throws:
  IllegalArgumentException - if fontFormat is notTRUETYPE_FONTorTYPE1_FONT.
throws:
  FontFormatException - if the fontStream data doesnot contain the required font tables for the specified format.
throws:
  IOException - if the fontStreamcannot be completely read.
See Also:   GraphicsEnvironment.registerFont(Font)
since:
   1.3




createFont
public static Font createFont(int fontFormat, File fontFile) throws java.awt.FontFormatException, java.io.IOException(Code)
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 Font.PLAIN 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 isFont.TRUETYPE_FONT TRUETYPE_FONT if a TrueType resource isspecified or Font.TYPE1_FONT TYPE1_FONT if a Type 1 resource isspecified.So long as the returned font, or its derived fonts are referencedthe implementation may continue to access fontFileto retrieve font data. Thus the results are undefined if the fileis changed, or becomes inaccessible.

To make the Font available to Font constructors thereturned Font must be registered in theGraphicsEnviroment by callingGraphicsEnvironment.registerFont(Font) registerFont(Font).
Parameters:
  fontFile - a File object representing theinput data for the font. a new Font created with the specified font type.
throws:
  IllegalArgumentException - if fontFormat is notTRUETYPE_FONTorTYPE1_FONT.
throws:
  NullPointerException - if fontFile is null.
throws:
  IOException - if the fontFile cannot be read.
throws:
  FontFormatException - if fontFile doesnot contain the required font tables for the specified format.
throws:
  SecurityException - if the executing code does not havepermission to read from the file.
See Also:   GraphicsEnvironment.registerFont(Font)
since:
   1.5




createGlyphVector
public GlyphVector createGlyphVector(FontRenderContext frc, String str)(Code)
Creates a java.awt.font.GlyphVector 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
Parameters:
  str - the specified String a new GlyphVector created with the specified String and the specifiedFontRenderContext.



createGlyphVector
public GlyphVector createGlyphVector(FontRenderContext frc, char[] chars)(Code)
Creates a java.awt.font.GlyphVector 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
Parameters:
  chars - the specified array of characters a new GlyphVector created with thespecified array of characters and the specifiedFontRenderContext.



createGlyphVector
public GlyphVector createGlyphVector(FontRenderContext frc, CharacterIterator ci)(Code)
Creates a java.awt.font.GlyphVector 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
Parameters:
  ci - the specified CharacterIterator a new GlyphVector created with thespecified CharacterIterator and the specifiedFontRenderContext.



createGlyphVector
public GlyphVector createGlyphVector(FontRenderContext frc, int[] glyphCodes)(Code)
Creates a java.awt.font.GlyphVector 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
Parameters:
  glyphCodes - the specified integer array a new GlyphVector created with thespecified integer array and the specifiedFontRenderContext.



decode
public static Font decode(String str)(Code)
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

  • fontname-style-pointsize
  • fontname-pointsize
  • fontname-style
  • fontname
  • fontname style pointsize
  • fontname pointsize
  • fontname style
  • fontname
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 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 the Font object that strdescribes, or a new default Font if str is null.
See Also:   Font.getFamily
since:
   JDK1.1




deriveFont
public Font deriveFont(int style, float size)(Code)
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
Parameters:
  size - the size for the new Font a new Font object.
since:
   1.2



deriveFont
public Font deriveFont(int style, AffineTransform trans)(Code)
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
Parameters:
  trans - the AffineTransform associated with thenew Font a new Font object.
throws:
  IllegalArgumentException - if trans isnull
since:
   1.2



deriveFont
public Font deriveFont(float size)(Code)
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. a new Font object.
since:
   1.2



deriveFont
public Font deriveFont(AffineTransform trans)(Code)
Creates a new Font object by replicating the current Font object and applying a new transform to it.
Parameters:
  trans - the AffineTransform associated with thenew Font a new Font object.
throws:
  IllegalArgumentException - if trans is null
since:
   1.2



deriveFont
public Font deriveFont(int style)(Code)
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 a new Font object.
since:
   1.2



deriveFont
public Font deriveFont(Map<? extends Attribute, ?> attributes)(Code)
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 a new Font object.
since:
   1.2



equals
public boolean equals(Object obj)(Code)
Compares this Font object to the specified Object.
Parameters:
  obj - the Object to compare true if the objects are the sameor if the argument is a Font objectdescribing the same font as this object; false otherwise.
since:
   JDK1.0



getAttributes
public Map<TextAttribute, ?> getAttributes()(Code)
Returns a map of font attributes available in this Font. Attributes include things like ligatures and glyph substitution. the attributes map of this Font.



getAvailableAttributes
public Attribute[] getAvailableAttributes()(Code)
Returns the keys of all the attributes supported by this Font. These attributes can be used to derive other fonts. an array containing the keys of all the attributessupported by this Font.
since:
   1.2



getBaselineFor
public byte getBaselineFor(char c)(Code)
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 the baseline appropriate for the specified character.
See Also:   LineMetrics.getBaselineOffsets
See Also:   Font.ROMAN_BASELINE
See Also:   Font.CENTER_BASELINE
See Also:   Font.HANGING_BASELINE
since:
   1.2




getFamily
public String getFamily()(Code)
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 method.

Use getName to get the logical name of the font. Use getFontName to get the font face name of the font. a String that is the family name of thisFont.
See Also:   Font.getName
See Also:   Font.getFontName
since:
   JDK1.1




getFamily
public String getFamily(Locale l)(Code)
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 method.

Use getFontName to get the font face name of the font.
Parameters:
  l - locale for which to get the family name a String representing the family name of thefont, localized for the specified locale.
See Also:   Font.getFontName
See Also:   java.util.Locale
since:
   1.2




getFamily_NoClientCode
final String getFamily_NoClientCode()(Code)



getFont
public static Font getFont(Map<? extends Attribute, ?> attributes)(Code)
Returns a Font appropriate to the attributes. If attributescontains a FONT attribute with a valid Font as its value, it will be merged with any remaining attributes. See java.awt.font.TextAttribute.FONT for more information.
Parameters:
  attributes - the attributes to assign to the new Font a new Font created with the specifiedattributes
throws:
  NullPointerException - if attributes is null.
since:
   1.2
See Also:   java.awt.font.TextAttribute



getFont
public static Font getFont(String nm)(Code)
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, or the executing code does not have permission to read the property, null is returned instead.
Parameters:
  nm - the property name a Font object that the property namedescribes, or null if no such property exists.
throws:
  NullPointerException - if nm is null.
since:
   1.2
See Also:   Font.decode(String)



getFont
public static Font getFont(String nm, Font font)(Code)
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, or the executing code does not have permission to read the property, the font argument is returned instead.
Parameters:
  nm - the case-insensitive property name
Parameters:
  font - a default Font to return if propertynm is not defined the Font value of the property.
throws:
  NullPointerException - if nm is null.
See Also:   Font.decode(String)




getFontName
public String getFontName()(Code)
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. a String representing the font face name of this Font.
See Also:   Font.getFamily
See Also:   Font.getName
since:
   1.2



getFontName
public String getFontName(Locale l)(Code)
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 a String representing the font face name,localized for the specified locale.
See Also:   Font.getFamily
See Also:   java.util.Locale



getItalicAngle
public float getItalicAngle()(Code)
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.
See Also:   TextAttribute.POSTURE the angle of the ITALIC style of this Font.



getLineMetrics
public LineMetrics getLineMetrics(String str, FontRenderContext frc)(Code)
Returns a LineMetrics object created with the specified String and FontRenderContext .
Parameters:
  str - the specified String
Parameters:
  frc - the specified FontRenderContext a LineMetrics object created with thespecified String and FontRenderContext.



getLineMetrics
public LineMetrics getLineMetrics(String str, int beginIndex, int limit, FontRenderContext frc)(Code)
Returns a LineMetrics object created with the specified arguments.
Parameters:
  str - the specified String
Parameters:
  beginIndex - the initial offset of str
Parameters:
  limit - the end offset of str
Parameters:
  frc - the specified FontRenderContext a LineMetrics object created with thespecified arguments.



getLineMetrics
public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit, FontRenderContext frc)(Code)
Returns a LineMetrics object created with the specified arguments.
Parameters:
  chars - an array of characters
Parameters:
  beginIndex - the initial offset of chars
Parameters:
  limit - the end offset of chars
Parameters:
  frc - the specified FontRenderContext a LineMetrics object created with thespecified arguments.



getLineMetrics
public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)(Code)
Returns a LineMetrics object created with the specified arguments.
Parameters:
  ci - the specified CharacterIterator
Parameters:
  beginIndex - the initial offset in ci
Parameters:
  limit - the end offset of ci
Parameters:
  frc - the specified FontRenderContext a LineMetrics object created with thespecified arguments.



getMaxCharBounds
public Rectangle2D getMaxCharBounds(FontRenderContext frc)(Code)
Returns the bounds for the character with the maximum bounds as defined in the specified FontRenderContext.

Note: The returned bounds is in baseline-relative coordinates (see java.awt.Font class notes ).
Parameters:
  frc - the specified FontRenderContext a Rectangle2D that is the bounding boxfor the character with the maximum bounds.




getMissingGlyphCode
public int getMissingGlyphCode()(Code)
Returns the glyphCode which is used when this Font does not have a glyph for a specified unicode code point. the glyphCode of this Font.
since:
   1.2



getName
public String getName()(Code)
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. a String representing the logical name ofthis Font.
See Also:   Font.getFamily
See Also:   Font.getFontName
since:
   JDK1.0



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



getPSName
public String getPSName()(Code)
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. a String representing the postscript name ofthis Font.
since:
   1.2



getPeer
public FontPeer getPeer()(Code)
Gets the peer of this Font. the peer of the Font.
since:
   JDK1.1



getPeer_NoClientCode
final FontPeer getPeer_NoClientCode()(Code)



getSize
public int getSize()(Code)
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. the point size of this Font in 1/72 of an inch units.
See Also:   Font.getSize2D
See Also:   GraphicsConfiguration.getDefaultTransform
See Also:   GraphicsConfiguration.getNormalizingTransform
since:
   JDK1.0




getSize2D
public float getSize2D()(Code)
Returns the point size of this Font in float value. the point size of this Font as afloat value.
See Also:   Font.getSize
since:
   1.2



getStringBounds
public Rectangle2D getStringBounds(String str, FontRenderContext frc)(Code)
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 TextLayout.getBounds getBounds method of TextLayout.

Note: The returned bounds is in baseline-relative coordinates (see java.awt.Font class notes ).
Parameters:
  str - the specified String
Parameters:
  frc - the specified FontRenderContext a Rectangle2D that is the bounding box of thespecified String in the specifiedFontRenderContext.
See Also:   FontRenderContext
See Also:   Font.createGlyphVector
since:
   1.2




getStringBounds
public Rectangle2D getStringBounds(String str, int beginIndex, int limit, FontRenderContext frc)(Code)
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 TextLayout.getBounds getBounds method of TextLayout.

Note: The returned bounds is in baseline-relative coordinates (see java.awt.Font class notes ).
Parameters:
  str - the specified String
Parameters:
  beginIndex - the initial offset of str
Parameters:
  limit - the end offset of str
Parameters:
  frc - the specified FontRenderContext a Rectangle2D that is the bounding box of thespecified String in the specifiedFontRenderContext.
throws:
  IndexOutOfBoundsException - if beginIndex is less than zero, or limit is greater than thelength of str, or beginIndexis greater than limit.
See Also:   FontRenderContext
See Also:   Font.createGlyphVector
since:
   1.2




getStringBounds
public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit, FontRenderContext frc)(Code)
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 TextLayout.getBounds getBounds method of TextLayout.

Note: The returned bounds is in baseline-relative coordinates (see java.awt.Font class notes ).
Parameters:
  chars - an array of characters
Parameters:
  beginIndex - the initial offset in the array ofcharacters
Parameters:
  limit - the end offset in the array of characters
Parameters:
  frc - the specified FontRenderContext a Rectangle2D that is the bounding box of thespecified array of characters in the specifiedFontRenderContext.
throws:
  IndexOutOfBoundsException - if beginIndex is less than zero, or limit is greater than thelength of chars, or beginIndexis greater than limit.
See Also:   FontRenderContext
See Also:   Font.createGlyphVector
since:
   1.2




getStringBounds
public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)(Code)
Returns the logical bounds of the characters indexed in the specified 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 TextLayout.getBounds getBounds method of TextLayout.

Note: The returned bounds is in baseline-relative coordinates (see java.awt.Font class notes ).
Parameters:
  ci - the specified CharacterIterator
Parameters:
  beginIndex - the initial offset in ci
Parameters:
  limit - the end offset in ci
Parameters:
  frc - the specified FontRenderContext a Rectangle2D that is the bounding box of thecharacters indexed in the specified CharacterIteratorin the specified FontRenderContext.
See Also:   FontRenderContext
See Also:   Font.createGlyphVector
since:
   1.2
throws:
  IndexOutOfBoundsException - if beginIndex isless than the start index of ci, or limit is greater than the end index of ci, or beginIndex is greater than limit




getStyle
public int getStyle()(Code)
Returns the style of this Font. The style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC. the style of this Font
See Also:   Font.isPlain
See Also:   Font.isBold
See Also:   Font.isItalic
since:
   JDK1.0



getTransform
public AffineTransform getTransform()(Code)
Returns a copy of the transform associated with this Font. This transform is not necessarily the one used to construct the font. If the font has algorithmic superscripting or width adjustment, this will be incorporated into the returned AffineTransform.

Typically, fonts will not be transformed. Clients generally should call Font.isTransformed first, and only call this method if isTransformed returns true. an AffineTransform object representing thetransform attribute of this Font object.




hasLayoutAttributes
public boolean hasLayoutAttributes()(Code)
Return true if this Font contains attributes that require extra layout processing. true if the font has layout attributes
since:
   1.6



hasUniformLineMetrics
public boolean hasUniformLineMetrics()(Code)
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. true if this Font hasuniform line metrics; false otherwise.



hashCode
public int hashCode()(Code)
Returns a hashcode for this Font. a hashcode value for this Font.
since:
   JDK1.0



isBold
public boolean isBold()(Code)
Indicates whether or not this Font object's style is BOLD. true if this Font object'sstyle is BOLD;false otherwise.
See Also:   java.awt.Font.getStyle
since:
   JDK1.0



isItalic
public boolean isItalic()(Code)
Indicates whether or not this Font object's style is ITALIC. true if this Font object'sstyle is ITALIC;false otherwise.
See Also:   java.awt.Font.getStyle
since:
   JDK1.0



isPlain
public boolean isPlain()(Code)
Indicates whether or not this Font object's style is PLAIN. true if this Font has aPLAIN sytle;false otherwise.
See Also:   java.awt.Font.getStyle
since:
   JDK1.0



isTransformed
public boolean isTransformed()(Code)
Indicates whether or not this Font object has a transform that affects its size in addition to the Size attribute. true if this Font objecthas a non-identity AffineTransform attribute.false otherwise.
See Also:   java.awt.Font.getTransform
since:
   1.4



layoutGlyphVector
public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags)(Code)
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.

Layout requires bidi analysis, as performed by 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
Parameters:
  text - the text to layout
Parameters:
  start - the start of the text to use for the GlyphVector
Parameters:
  limit - the limit of the text to use for the GlyphVector
Parameters:
  flags - control flags as described above a new GlyphVector representing the text betweenstart and limit, with glyphs chosen and positioned so as to best represent the text
throws:
  ArrayIndexOutOfBoundsException - if start or limit is out of bounds
See Also:   java.text.Bidi
See Also:   Font.LAYOUT_LEFT_TO_RIGHT
See Also:   Font.LAYOUT_RIGHT_TO_LEFT
See Also:   Font.LAYOUT_NO_START_CONTEXT
See Also:   Font.LAYOUT_NO_LIMIT_CONTEXT
since:
   1.4




toString
public String toString()(Code)
Converts this Font object to a String representation. a String representation of this Font object.
since:
   JDK1.0



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.