Class FontUIResource
- All Implemented Interfaces:
Serializable, UIResource
public class FontUIResource extends Font implements UIResource
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.
- See Also:
Field Summary
Fields declared in class Font
BOLD, CENTER_BASELINE, DIALOG, DIALOG_INPUT, HANGING_BASELINE, ITALIC, LAYOUT_LEFT_TO_RIGHT, LAYOUT_NO_LIMIT_CONTEXT, LAYOUT_NO_START_CONTEXT, LAYOUT_RIGHT_TO_LEFT, MONOSPACED, name, PLAIN, pointSize, ROMAN_BASELINE, SANS_SERIF, SERIF, size, style, TRUETYPE_FONT, TYPE1_FONT | Modifier and Type | Field | Description |
|---|---|---|
static final int |
BOLD |
The bold style constant. |
static final int |
CENTER_BASELINE |
The baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text. |
static final String |
DIALOG |
A String constant for the canonical family name of the logical font "Dialog". |
static final String |
DIALOG_INPUT |
A String constant for the canonical family name of the logical font "DialogInput". |
static final int |
HANGING_BASELINE |
The baseline used in Devanagari and similar scripts when laying out text. |
static final int |
ITALIC |
The italicized style constant. |
static final int |
LAYOUT_LEFT_TO_RIGHT |
A flag to layoutGlyphVector indicating that text is left-to-right as determined by Bidi analysis. |
static final int |
LAYOUT_NO_LIMIT_CONTEXT |
A flag to layoutGlyphVector indicating that text in the char array after the indicated limit should not be examined. |
static final int |
LAYOUT_NO_START_CONTEXT |
A flag to layoutGlyphVector indicating that text in the char array before the indicated start should not be examined. |
static final int |
LAYOUT_RIGHT_TO_LEFT |
A flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis. |
static final String |
MONOSPACED |
A String constant for the canonical family name of the logical font "Monospaced". |
protected String |
name |
The logical name of this Font, as passed to the constructor. |
static final int |
PLAIN |
The plain style constant. |
protected float |
pointSize |
The point size of this Font in float. |
static final int |
ROMAN_BASELINE |
The baseline used in most Roman scripts when laying out text. |
static final String |
SANS_SERIF |
A String constant for the canonical family name of the logical font "SansSerif". |
static final String |
SERIF |
A String constant for the canonical family name of the logical font "Serif". |
protected int |
size |
The point size of this Font, rounded to integer. |
protected int |
style |
The style of this Font, as passed to the constructor. |
static final int |
TRUETYPE_FONT |
Identify a font resource of type TRUETYPE. |
static final int |
TYPE1_FONT |
Identify a font resource of type TYPE1. |
Constructor Summary
| Constructor | Description |
|---|---|
FontUIResource |
Constructs a FontUIResource. |
FontUIResource |
Constructs a FontUIResource. |
Method Summary
Methods declared in class Font
canDisplay, canDisplay, canDisplayUpTo, canDisplayUpTo, canDisplayUpTo, createFont, createFont, createFonts, createFonts, createGlyphVector, createGlyphVector, createGlyphVector, createGlyphVector, decode, deriveFont, deriveFont, deriveFont, deriveFont, deriveFont, deriveFont, equals, getAttributes, getAvailableAttributes, getBaselineFor, getFamily, getFamily, getFont, getFont, getFont, getFontName, getFontName, getItalicAngle, getLineMetrics, getLineMetrics, getLineMetrics, getLineMetrics, getMaxCharBounds, getMissingGlyphCode, getName, getNumGlyphs, getPSName, getSize, getSize2D, getStringBounds, getStringBounds, getStringBounds, getStringBounds, getStyle, getTransform, hashCode, hasLayoutAttributes, hasUniformLineMetrics, isBold, isItalic, isPlain, isTransformed, layoutGlyphVector, textRequiresLayout, toString | Modifier and Type | Method | Description |
|---|---|---|
boolean |
canDisplay |
Checks if this Font has a glyph for the specified character. |
boolean |
canDisplay |
Checks if this Font has a glyph for the specified character. |
int |
canDisplayUpTo |
Indicates whether or not this Font can display the characters in the specified text starting at start and ending at limit. |
int |
canDisplayUpTo |
Indicates whether or not this Font can display a specified String. |
int |
canDisplayUpTo |
Indicates whether or not this Font can display the text specified by the iter starting at start and ending at limit. |
static Font |
createFont |
Returns a new Font using the specified font type and the specified font file. |
static Font |
createFont |
Returns a new Font using the specified font type and input data. |
static Font[] |
createFonts |
Returns a new array of Font decoded from the specified file. |
static Font[] |
createFonts |
Returns a new array of Font decoded from the specified stream. |
GlyphVector |
createGlyphVector |
Creates a GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font. |
GlyphVector |
createGlyphVector |
Creates a GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font. |
GlyphVector |
createGlyphVector |
Creates a GlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this Font. |
GlyphVector |
createGlyphVector |
Creates a GlyphVector by mapping the specified characters to glyphs one-to-one based on the Unicode cmap in this Font. |
static Font |
decode |
Returns the Font that the str argument describes. |
Font |
deriveFont |
Creates a new Font object by replicating the current Font object and applying a new size to it. |
Font |
deriveFont |
Creates a new Font object by replicating the current Font object and applying a new style to it. |
Font |
deriveFont |
Creates a new Font object by replicating this Font object and applying a new style and size. |
Font |
deriveFont |
Creates a new Font object by replicating this Font object and applying a new style and transform. |
Font |
deriveFont |
Creates a new Font object by replicating the current Font object and applying a new transform to it. |
Font |
deriveFont |
Creates a new Font object by replicating the current Font object and applying a new set of font attributes to it. |
boolean |
equals |
Compares this Font object to the specified Object. |
Map |
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 |
Returns the baseline appropriate for displaying this character. |
String |
getFamily() |
Returns the family name of this Font. |
String |
getFamily |
Returns the family name of this Font, localized for the specified locale. |
static Font |
getFont |
Returns a Font object from the system properties list. |
static Font |
getFont |
Gets the specified Font from the system properties list. |
static Font |
getFont |
Returns a Font appropriate to the attributes. |
String |
getFontName() |
Returns the font face name of this Font. |
String |
getFontName |
Returns the font face name of the Font, localized for the specified locale. |
float |
getItalicAngle() |
Returns the italic angle of this Font. |
LineMetrics |
getLineMetrics |
Returns a LineMetrics object created with the specified arguments. |
LineMetrics |
getLineMetrics |
Returns a LineMetrics object created with the specified arguments. |
LineMetrics |
getLineMetrics |
|
LineMetrics |
getLineMetrics |
Returns a LineMetrics object created with the specified arguments. |
Rectangle2D |
getMaxCharBounds |
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 code point. |
String |
getName() |
Returns the logical name of this Font. |
int |
getNumGlyphs() |
Returns the number of glyphs in this Font. |
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 |
Returns the logical bounds of the specified array of characters in the specified FontRenderContext. |
Rectangle2D |
getStringBounds |
Returns the logical bounds of the specified String in the specified FontRenderContext. |
Rectangle2D |
getStringBounds |
Returns the logical bounds of the specified String in the specified FontRenderContext. |
Rectangle2D |
getStringBounds |
Returns the logical bounds of the characters indexed in the specified CharacterIterator 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 |
hasLayoutAttributes() |
Return true if this Font contains attributes that require extra layout processing. |
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 |
Returns a new GlyphVector object, performing full layout of the text if possible. |
static boolean |
textRequiresLayout |
Returns true if any part of the specified text is from a complex script for which the implementation will need to invoke layout processing in order to render correctly when using drawString(String,int,int) and other text rendering methods. |
String |
toString() |
Converts this Font object to a String representation. |
Methods declared in class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
FontUIResource
public FontUIResource(String name, int style, int size)
FontUIResource.- Parameters:
-
name- the font name -
style- the style constant for the font -
size- the point size of the font
FontUIResource
public FontUIResource(Font font)
FontUIResource.- Parameters:
-
font- the font
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.