|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.5.0
java.awt
|
Field Summary | |
---|---|
static int |
BOLD
The bold style constant. |
static int |
CENTER_BASELINE
The baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text. |
static int |
HANGING_BASELINE
The baseline used in Devanigiri and similar scripts when laying out text. |
static int |
ITALIC
The italicized style constant. |
static int |
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
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
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
A flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis. |
protected String |
name
The logical name of this Font , as passed to the
constructor. |
static int |
PLAIN
The plain style constant. |
protected float |
pointSize
The point size of this Font in float . |
static int |
ROMAN_BASELINE
The baseline used in most Roman scripts when laying out text. |
protected int |
size
The point size of this Font , rounded to integer. |
protected int |
style
The style of this Font , as passed to the constructor. |
static int |
TRUETYPE_FONT
Identify a font resource of type TRUETYPE. |
static int |
TYPE1_FONT
Identify a font resource of type TYPE1. |
Constructor Summary | |
---|---|
Font(Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
Creates a new Font with the specified attributes. |
|
Font(String name,
int style,
int size)
Creates a new Font from the specified name, style and
point size. |
Method Summary | |
---|---|
boolean |
canDisplay(char c)
Checks if this Font has a glyph for the specified
character. |
boolean |
canDisplay(int codePoint)
Checks if this Font has a glyph for the specified
character. |
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 . |
int |
canDisplayUpTo(CharacterIterator iter,
int start,
int limit)
Indicates whether or not this Font can display the
text specified by the iter starting at
start and ending at limit . |
int |
canDisplayUpTo(String str)
Indicates whether or not this Font can display a
specified String . |
static Font |
createFont(int fontFormat,
File fontFile)
Returns a new Font using the specified font type
and the specified font file. |
static Font |
createFont(int fontFormat,
InputStream fontStream)
Returns a new Font using the specified font type
and input data. |
GlyphVector |
createGlyphVector(FontRenderContext frc,
char[] chars)
Creates a GlyphVector by
mapping characters to glyphs one-to-one based on the
Unicode cmap in this Font . |
GlyphVector |
createGlyphVector(FontRenderContext frc,
CharacterIterator ci)
Creates a GlyphVector by
mapping the specified characters to glyphs one-to-one based on the
Unicode cmap in this Font . |
GlyphVector |
createGlyphVector(FontRenderContext frc,
int[] glyphCodes)
Creates a GlyphVector by
mapping characters to glyphs one-to-one based on the
Unicode cmap in this Font . |
GlyphVector |
createGlyphVector(FontRenderContext frc,
String str)
Creates a GlyphVector by
mapping characters to glyphs one-to-one based on the
Unicode cmap in this Font . |
static Font |
decode(String str)
Returns the Font that the str
argument describes. |
Font |
deriveFont(AffineTransform trans)
Creates a new Font object by replicating the current
Font object and applying a new transform to it. |
Font |
deriveFont(float size)
Creates a new Font object by replicating the current
Font object and applying a new size to it. |
Font |
deriveFont(int style)
Creates a new Font object by replicating the current
Font object and applying a new style to it. |
Font |
deriveFont(int style,
AffineTransform trans)
Creates a new Font object by replicating this
Font object and applying a new style and transform. |
Font |
deriveFont(int style,
float size)
Creates a new Font object by replicating this
Font object and applying a new style and size. |
Font |
deriveFont(Map<? extends 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(Object obj)
Compares this Font object to the specified
Object . |
protected void |
finalize()
Disposes the native Font object. |
Map<TextAttribute,?> |
getAttributes()
Returns a map of font attributes available in this Font . |
AttributedCharacterIterator.Attribute[] |
getAvailableAttributes()
Returns the keys of all the attributes supported by this Font . |
byte |
getBaselineFor(char c)
Returns the baseline appropriate for displaying this character. |
String |
getFamily()
Returns the family name of this Font . |
String |
getFamily(Locale l)
Returns the family name of this Font , localized for
the specified locale. |
static Font |
getFont(Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
Returns a Font appropriate to this attribute set. |
static Font |
getFont(String nm)
Returns a Font object from the system properties list. |
static Font |
getFont(String nm,
Font font)
Gets the specified Font from the system properties
list. |
String |
getFontName()
Returns the font face name of this Font . |
String |
getFontName(Locale l)
Returns the font face name of the Font , localized
for the specified locale. |
float |
getItalicAngle()
Returns the italic angle of this Font . |
LineMetrics |
getLineMetrics(char[] chars,
int beginIndex,
int limit,
FontRenderContext frc)
Returns a LineMetrics object created with the
specified arguments. |
LineMetrics |
getLineMetrics(CharacterIterator ci,
int beginIndex,
int limit,
FontRenderContext frc)
Returns a LineMetrics object created with the
specified arguments. |
LineMetrics |
getLineMetrics(String str,
FontRenderContext frc)
Returns a LineMetrics object created with the specified
String and FontRenderContext . |
LineMetrics |
getLineMetrics(String str,
int beginIndex,
int limit,
FontRenderContext frc)
Returns a LineMetrics object created with the
specified arguments. |
Rectangle2D |
getMaxCharBounds(FontRenderContext frc)
Returns the bounds for the character with the maximum bounds as defined in the specified FontRenderContext . |
int |
getMissingGlyphCode()
Returns the glyphCode which is used when this Font
does not have a glyph for a specified unicode. |
String |
getName()
Returns the logical name of this Font . |
int |
getNumGlyphs()
Returns the number of glyphs in this Font . |
java.awt.peer.FontPeer |
getPeer()
Deprecated. Font rendering is now platform independent. |
String |
getPSName()
Returns the postscript name of this Font . |
int |
getSize()
Returns the point size of this Font , rounded to
an integer. |
float |
getSize2D()
Returns the point size of this Font in
float value. |
Rectangle2D |
getStringBounds(char[] chars,
int beginIndex,
int limit,
FontRenderContext frc)
Returns the logical bounds of the specified array of characters in the specified FontRenderContext . |
Rectangle2D |
getStringBounds(CharacterIterator ci,
int beginIndex,
int limit,
FontRenderContext frc)
Returns the logical bounds of the characters indexed in the specified CharacterIterator in the
specified FontRenderContext . |
Rectangle2D |
getStringBounds(String str,
FontRenderContext frc)
Returns the logical bounds of the specified String in
the specified FontRenderContext . |
Rectangle2D |
getStringBounds(String str,
int beginIndex,
int limit,
FontRenderContext frc)
Returns the logical bounds of the specified String in
the specified FontRenderContext . |
int |
getStyle()
Returns the style of this Font . |
AffineTransform |
getTransform()
Returns a copy of the transform associated with this Font . |
int |
hashCode()
Returns a hashcode for this Font . |
boolean |
hasUniformLineMetrics()
Checks whether or not this Font has uniform
line metrics. |
boolean |
isBold()
Indicates whether or not this Font object's style is
BOLD. |
boolean |
isItalic()
Indicates whether or not this Font object's style is
ITALIC. |
boolean |
isPlain()
Indicates whether or not this Font object's style is
PLAIN. |
boolean |
isTransformed()
Indicates whether or not this Font object has a
transform that affects its size in addition to the Size
attribute. |
GlyphVector |
layoutGlyphVector(FontRenderContext frc,
char[] text,
int start,
int limit,
int flags)
Returns a new GlyphVector object, performing full
layout of the text if possible. |
String |
toString()
Converts this Font object to a String
representation. |
Methods inherited from class java.lang.Object |
---|
clone, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PLAIN
public static final int BOLD
public static final int ITALIC
public static final int ROMAN_BASELINE
public static final int CENTER_BASELINE
public static final int HANGING_BASELINE
public static final int TRUETYPE_FONT
createFont(int, java.io.InputStream)
method.
public static final int TYPE1_FONT
createFont(int, java.io.InputStream)
method.
protected String name
Font
, as passed to the
constructor.
getName()
protected int style
Font
, as passed to the constructor.
This style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.
getStyle()
protected int size
Font
, rounded to integer.
getSize()
protected float pointSize
Font
in float
.
getSize()
,
getSize2D()
public static final int LAYOUT_LEFT_TO_RIGHT
public static final int LAYOUT_RIGHT_TO_LEFT
public static final int LAYOUT_NO_START_CONTEXT
public static final int LAYOUT_NO_LIMIT_CONTEXT
Constructor Detail |
---|
public Font(String name, int style, int size)
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.
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
GraphicsEnvironment.getAllFonts()
,
GraphicsEnvironment.getAvailableFontFamilyNames()
public Font(Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
Font
with the specified attributes.
This Font
only recognizes keys defined in
TextAttribute
as attributes. If attributes
is null
, a new Font
is initialized
with default attributes.
attributes
- the attributes to assign to the new
Font
, or null
Method Detail |
---|
@Deprecated public java.awt.peer.FontPeer getPeer()
Font
.
Font
.public static Font getFont(Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
Font
appropriate to this attribute set.
attributes
- the attributes to assign to the new
Font
Font
created with the specified
attributesTextAttribute
public static Font createFont(int fontFormat, InputStream fontStream) throws FontFormatException, IOException
Font
using the specified font type
and input data. The new Font
is
created with a point size of 1 and style 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
.
fontFormat
- the type of the Font
, which is
TRUETYPE_FONT
if a TrueType resource is specified.
or TYPE1_FONT
if a Type 1 resource is specified.fontStream
- an InputStream
object representing the
input data for the font.
Font
created with the specified font type.
IllegalArgumentException
- if fontFormat
is not
TRUETYPE_FONT
orTYPE1_FONT
.
FontFormatException
- if the fontStream
data does
not contain the required font tables for the specified format.
IOException
- if the fontStream
cannot be completely read.public static Font createFont(int fontFormat, File fontFile) throws FontFormatException, IOException
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
.
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.
fontFormat
- the type of the Font
, which is
TRUETYPE_FONT
if a TrueType resource is
specified or 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.
Font
created with the specified font type.
IllegalArgumentException
- if fontFormat
is not
TRUETYPE_FONT
orTYPE1_FONT
.
NullPointerException
- if fontFile
is null.
IOException
- if the fontFile
cannot be read.
FontFormatException
- if fontFile
does
not contain the required font tables for the specified format.
SecurityException
- if the executing code does not have
permission to read from the file.public AffineTransform getTransform()
Font
.
AffineTransform
object representing the
transform attribute of this Font
object.public String getFamily()
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.
String
that is the family name of this
Font
.getName()
,
getFontName()
public String getFamily(Locale l)
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.
l
- locale for which to get the family name
String
representing the family name of the
font, localized for the specified locale.getFontName()
,
Locale
public String getPSName()
Font
.
Use getFamily
to get the family name of the font.
Use getFontName
to get the font face name of the font.
String
representing the postscript name of
this Font
.public String getName()
Font
.
Use getFamily
to get the family name of the font.
Use getFontName
to get the font face name of the font.
String
representing the logical name of
this Font
.getFamily()
,
getFontName()
public String getFontName()
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.
String
representing the font face name of
this Font
.getFamily()
,
getName()
public String getFontName(Locale l)
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.
l
- a locale for which to get the font face name
String
representing the font face name,
localized for the specified locale.getFamily()
,
Locale
public int getStyle()
Font
. The style can be
PLAIN, BOLD, ITALIC, or BOLD+ITALIC.
Font
isPlain()
,
isBold()
,
isItalic()
public int getSize()
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.
Font
in 1/72 of an
inch units.getSize2D()
,
GraphicsConfiguration.getDefaultTransform()
,
GraphicsConfiguration.getNormalizingTransform()
public float getSize2D()
Font
in
float
value.
Font
as a
float
value.getSize()
public boolean isPlain()
Font
object's style is
PLAIN.
true
if this Font
has a
PLAIN sytle;
false
otherwise.getStyle()
public boolean isBold()
Font
object's style is
BOLD.
true
if this Font
object's
style is BOLD;
false
otherwise.getStyle()
public boolean isItalic()
Font
object's style is
ITALIC.
true
if this Font
object's
style is ITALIC;
false
otherwise.getStyle()
public boolean isTransformed()
Font
object has a
transform that affects its size in addition to the Size
attribute.
true
if this Font
object
has a non-identity AffineTransform attribute.
false
otherwise.getTransform()
public static Font getFont(String nm)
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.
nm
- the property name
Font
object that the property name
describes, or null if no such property exists.
NullPointerException
- if nm is null.decode(String)
public static Font decode(String str)
Font
that the str
argument describes.
To ensure that this method returns the desired Font,
format the str
parameter in
one of these ways
"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.
str
- the name of the font, or null
Font
object that str
describes, or a new default Font
if
str
is null
.getFamily()
public static Font getFont(String nm, Font font)
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.
nm
- the case-insensitive property namefont
- a default Font
to return if property
nm
is not defined
Font
value of the property.
NullPointerException
- if nm is null.decode(String)
public int hashCode()
Font
.
Font
.Object.equals(java.lang.Object)
,
Hashtable
public boolean equals(Object obj)
Font
object to the specified
Object
.
obj
- the Object
to compare
true
if the objects are the same
or if the argument is a Font
object
describing the same font as this object;
false
otherwise.Object.hashCode()
,
Hashtable
public String toString()
Font
object to a String
representation.
String
representation of this
Font
object.public int getNumGlyphs()
Font
. Glyph codes
for this Font
range from 0 to
getNumGlyphs()
- 1.
Font
.public int getMissingGlyphCode()
Font
does not have a glyph for a specified unicode.
Font
.public byte getBaselineFor(char c)
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.
c
- a character used to identify the writing system
LineMetrics.getBaselineOffsets()
,
ROMAN_BASELINE
,
CENTER_BASELINE
,
HANGING_BASELINE
public Map<TextAttribute,?> getAttributes()
Font
. Attributes include things like ligatures and
glyph substitution.
Font
.public AttributedCharacterIterator.Attribute[] getAvailableAttributes()
Font
. These attributes can be used to derive other
fonts.
Font
.public Font deriveFont(int style, float size)
Font
object by replicating this
Font
object and applying a new style and size.
style
- the style for the new Font
size
- the size for the new Font
Font
object.public Font deriveFont(int style, AffineTransform trans)
Font
object by replicating this
Font
object and applying a new style and transform.
style
- the style for the new Font
trans
- the AffineTransform
associated with the
new Font
Font
object.
IllegalArgumentException
- if trans
is
null
public Font deriveFont(float size)
Font
object by replicating the current
Font
object and applying a new size to it.
size
- the size for the new Font
.
Font
object.public Font deriveFont(AffineTransform trans)
Font
object by replicating the current
Font
object and applying a new transform to it.
trans
- the AffineTransform
associated with the
new Font
Font
object.
IllegalArgumentException
- if trans
is
null
public Font deriveFont(int style)
Font
object by replicating the current
Font
object and applying a new style to it.
style
- the style for the new Font
Font
object.public Font deriveFont(Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
Font
object by replicating the current
Font
object and applying a new set of font attributes
to it.
attributes
- a map of attributes enabled for the new
Font
Font
object.public boolean canDisplay(char c)
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)
method or canDisplayUpTo
methods.
c
- the character for which a glyph is needed
true
if this Font
has a glyph for this
character; false
otherwise.public boolean canDisplay(int codePoint)
Font
has a glyph for the specified
character.
codePoint
- the character (Unicode code point) for which a glyph
is needed.
true
if this Font
has a glyph for the
character; false
otherwise.
IllegalArgumentException
- if the code point is not a valid Unicode
code point.Character.isValidCodePoint(int)
public int canDisplayUpTo(String str)
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.
str
- a String
object
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
.public int canDisplayUpTo(char[] text, int start, int limit)
Font
can display
the characters in the specified text
starting at start
and ending at
limit
. This method is a convenience overload.
text
- the specified array of char
valuesstart
- the specified starting offset (in
char
s) into the specified array of
char
valueslimit
- the specified ending offset (in
char
s) into the specified array of
char
values
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
.public int canDisplayUpTo(CharacterIterator iter, int start, int limit)
Font
can display the
text specified by the iter
starting at
start
and ending at limit
.
iter
- a CharacterIterator
objectstart
- the specified starting offset into the specified
CharacterIterator
.limit
- the specified ending offset into the specified
CharacterIterator
.
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
.public float getItalicAngle()
Font
. The italic angle
is the inverse slope of the caret which best matches the posture of this
Font
.
Font
.TextAttribute.POSTURE
public boolean hasUniformLineMetrics()
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
has
uniform line metrics; false
otherwise.public LineMetrics getLineMetrics(String str, FontRenderContext frc)
LineMetrics
object created with the specified
String
and FontRenderContext
.
str
- the specified String
frc
- the specified FontRenderContext
LineMetrics
object created with the
specified String
and FontRenderContext
.public LineMetrics getLineMetrics(String str, int beginIndex, int limit, FontRenderContext frc)
LineMetrics
object created with the
specified arguments.
str
- the specified String
beginIndex
- the initial offset of str
limit
- the end offset of str
frc
- the specified FontRenderContext
LineMetrics
object created with the
specified arguments.public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit, FontRenderContext frc)
LineMetrics
object created with the
specified arguments.
chars
- an array of charactersbeginIndex
- the initial offset of chars
limit
- the end offset of chars
frc
- the specified FontRenderContext
LineMetrics
object created with the
specified arguments.public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)
LineMetrics
object created with the
specified arguments.
ci
- the specified CharacterIterator
beginIndex
- the initial offset in ci
limit
- the end offset of ci
frc
- the specified FontRenderContext
LineMetrics
object created with the
specified arguments.public Rectangle2D getStringBounds(String str, FontRenderContext frc)
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
method of
TextLayout
.
str
- the specified String
frc
- the specified FontRenderContext
Rectangle2D
that is the bounding box of the
specified String
in the specified
FontRenderContext
.FontRenderContext
,
createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)
public Rectangle2D getStringBounds(String str, int beginIndex, int limit, FontRenderContext frc)
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
method of
TextLayout
.
str
- the specified String
beginIndex
- the initial offset of str
limit
- the end offset of str
frc
- the specified FontRenderContext
Rectangle2D
that is the bounding box of the
specified String
in the specified
FontRenderContext
.
IndexOutOfBoundsException
- if beginIndex
is
less than zero, or limit
is greater than the
length of str
, or beginIndex
is greater than limit
.FontRenderContext
,
createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)
public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit, FontRenderContext frc)
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
method of
TextLayout
.
chars
- an array of charactersbeginIndex
- the initial offset in the array of
characterslimit
- the end offset in the array of charactersfrc
- the specified FontRenderContext
Rectangle2D
that is the bounding box of the
specified array of characters in the specified
FontRenderContext
.
IndexOutOfBoundsException
- if beginIndex
is
less than zero, or limit
is greater than the
length of chars
, or beginIndex
is greater than limit
.FontRenderContext
,
createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)
public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc)
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
method of
TextLayout
.
ci
- the specified CharacterIterator
beginIndex
- the initial offset in ci
limit
- the end offset in ci
frc
- the specified FontRenderContext
Rectangle2D
that is the bounding box of the
characters indexed in the specified CharacterIterator
in the specified FontRenderContext
.
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
FontRenderContext
,
createGlyphVector(java.awt.font.FontRenderContext, java.lang.String)
public Rectangle2D getMaxCharBounds(FontRenderContext frc)
FontRenderContext
.
frc
- the specified FontRenderContext
Rectangle2D
that is the bounding box
for the character with the maximum bounds.public GlyphVector createGlyphVector(FontRenderContext frc, String str)
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.
frc
- the specified FontRenderContext
str
- the specified String
GlyphVector
created with the
specified String
and the specified
FontRenderContext
.public GlyphVector createGlyphVector(FontRenderContext frc, char[] chars)
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.
frc
- the specified FontRenderContext
chars
- the specified array of characters
GlyphVector
created with the
specified array of characters and the specified
FontRenderContext
.public GlyphVector createGlyphVector(FontRenderContext frc, CharacterIterator ci)
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.
frc
- the specified FontRenderContext
ci
- the specified CharacterIterator
GlyphVector
created with the
specified CharacterIterator
and the specified
FontRenderContext
.public GlyphVector createGlyphVector(FontRenderContext frc, int[] glyphCodes)
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.
frc
- the specified FontRenderContext
glyphCodes
- the specified integer array
GlyphVector
created with the
specified integer array and the specified
FontRenderContext
.public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags)
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.
frc
- the specified FontRenderContext
text
- the text to layoutstart
- 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
GlyphVector
representing the text between
start and limit, with glyphs chosen and positioned so as to best represent
the text
ArrayIndexOutOfBoundsException
- if start or limit is
out of boundsBidi
,
LAYOUT_LEFT_TO_RIGHT
,
LAYOUT_RIGHT_TO_LEFT
,
LAYOUT_NO_START_CONTEXT
,
LAYOUT_NO_LIMIT_CONTEXT
protected void finalize() throws Throwable
Font
object.
Throwable
- the Exception
raised by this method