Class FontUIResource
java.lang.Object
java.awt.Font
javax.swing.plaf.FontUIResource
- All Implemented Interfaces:
Serializable, UIResource
A subclass of java.awt.Font that implements UIResource.
UI classes which set default font properties should use
this class.
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_FONTModifier and TypeFieldDescriptionstatic final intThe bold style constant.static final intThe baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text.static final StringA String constant for the canonical family name of the logical font "Dialog".static final StringA String constant for the canonical family name of the logical font "DialogInput".static final intThe baseline used in Devanagari and similar scripts when laying out text.static final intThe italicized style constant.static final intA flag to layoutGlyphVector indicating that text is left-to-right as determined by Bidi analysis.static final intA flag to layoutGlyphVector indicating that text in the char array after the indicated limit should not be examined.static final intA flag to layoutGlyphVector indicating that text in the char array before the indicated start should not be examined.static final intA flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis.static final StringA String constant for the canonical family name of the logical font "Monospaced".protected StringThe logical name of thisFont, as passed to the constructor.static final intThe plain style constant.protected floatThe point size of thisFontinfloat.static final intThe baseline used in most Roman scripts when laying out text.static final StringA String constant for the canonical family name of the logical font "SansSerif".static final StringA String constant for the canonical family name of the logical font "Serif".protected intThe point size of thisFont, rounded to integer.protected intThe style of thisFont, as passed to the constructor.static final intIdentify a font resource of type TRUETYPE.static final intIdentify a font resource of type TYPE1. -
Constructor Summary
ConstructorsConstructorDescriptionFontUIResource(Font font) Constructs aFontUIResource.FontUIResource(String name, int style, int size) Constructs aFontUIResource. -
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, toStringModifier and TypeMethodDescriptionbooleancanDisplay(char c) Checks if thisFonthas a glyph for the specified character.booleancanDisplay(int codePoint) Checks if thisFonthas a glyph for the specified character.intcanDisplayUpTo(char[] text, int start, int limit) Indicates whether or not thisFontcan display the characters in the specifiedtextstarting atstartand ending atlimit.intcanDisplayUpTo(String str) Indicates whether or not thisFontcan display a specifiedString.intcanDisplayUpTo(CharacterIterator iter, int start, int limit) Indicates whether or not thisFontcan display the text specified by theiterstarting atstartand ending atlimit.static FontcreateFont(int fontFormat, File fontFile) Returns a newFontusing the specified font type and the specified font file.static FontcreateFont(int fontFormat, InputStream fontStream) Returns a newFontusing the specified font type and input data.static Font[]createFonts(File fontFile) Returns a new array ofFontdecoded from the specified file.static Font[]createFonts(InputStream fontStream) Returns a new array ofFontdecoded from the specified stream.createGlyphVector(FontRenderContext frc, char[] chars) Creates aGlyphVectorby mapping characters to glyphs one-to-one based on the Unicode cmap in thisFont.createGlyphVector(FontRenderContext frc, int[] glyphCodes) Creates aGlyphVectorby mapping characters to glyphs one-to-one based on the Unicode cmap in thisFont.createGlyphVector(FontRenderContext frc, String str) Creates aGlyphVectorby mapping characters to glyphs one-to-one based on the Unicode cmap in thisFont.Creates aGlyphVectorby mapping the specified characters to glyphs one-to-one based on the Unicode cmap in thisFont.static FontReturns theFontthat thestrargument describes.deriveFont(float size) Creates a newFontobject by replicating the currentFontobject and applying a new size to it.deriveFont(int style) Creates a newFontobject by replicating the currentFontobject and applying a new style to it.deriveFont(int style, float size) Creates a newFontobject by replicating thisFontobject and applying a new style and size.deriveFont(int style, AffineTransform trans) Creates a newFontobject by replicating thisFontobject and applying a new style and transform.deriveFont(AffineTransform trans) Creates a newFontobject by replicating the currentFontobject and applying a new transform to it.deriveFont(Map<? extends AttributedCharacterIterator.Attribute, ?> attributes) Creates a newFontobject by replicating the currentFontobject and applying a new set of font attributes to it.booleanCompares thisFontobject to the specifiedObject.Map<TextAttribute, ?> Returns a map of font attributes available in thisFont.Returns the keys of all the attributes supported by thisFont.bytegetBaselineFor(char c) Returns the baseline appropriate for displaying this character.Returns the family name of thisFont.Returns the family name of thisFont, localized for the specified locale.static FontReturns aFontobject from the system properties list.static FontGets the specifiedFontfrom the system properties list.static FontgetFont(Map<? extends AttributedCharacterIterator.Attribute, ?> attributes) Returns aFontappropriate to the attributes.Returns the font face name of thisFont.Returns the font face name of theFont, localized for the specified locale.floatReturns the italic angle of thisFont.getLineMetrics(char[] chars, int beginIndex, int limit, FontRenderContext frc) Returns aLineMetricsobject created with the specified arguments.getLineMetrics(String str, int beginIndex, int limit, FontRenderContext frc) Returns aLineMetricsobject created with the specified arguments.getLineMetrics(String str, FontRenderContext frc) getLineMetrics(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc) Returns aLineMetricsobject created with the specified arguments.Returns the bounds for the character with the maximum bounds as defined in the specifiedFontRenderContext.intReturns the glyphCode which is used when thisFontdoes not have a glyph for a specified unicode code point.getName()Returns the logical name of thisFont.intReturns the number of glyphs in thisFont.Returns the postscript name of thisFont.intgetSize()Returns the point size of thisFont, rounded to an integer.floatReturns the point size of thisFontinfloatvalue.getStringBounds(char[] chars, int beginIndex, int limit, FontRenderContext frc) Returns the logical bounds of the specified array of characters in the specifiedFontRenderContext.getStringBounds(String str, int beginIndex, int limit, FontRenderContext frc) Returns the logical bounds of the specifiedStringin the specifiedFontRenderContext.getStringBounds(String str, FontRenderContext frc) Returns the logical bounds of the specifiedStringin the specifiedFontRenderContext.getStringBounds(CharacterIterator ci, int beginIndex, int limit, FontRenderContext frc) Returns the logical bounds of the characters indexed in the specifiedCharacterIteratorin the specifiedFontRenderContext.intgetStyle()Returns the style of thisFont.Returns a copy of the transform associated with thisFont.inthashCode()Returns a hashcode for thisFont.booleanReturn true if this Font contains attributes that require extra layout processing.booleanChecks whether or not thisFonthas uniform line metrics.booleanisBold()Indicates whether or not thisFontobject's style is BOLD.booleanisItalic()Indicates whether or not thisFontobject's style is ITALIC.booleanisPlain()Indicates whether or not thisFontobject's style is PLAIN.booleanIndicates whether or not thisFontobject has a transform that affects its size in addition to the Size attribute.layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) Returns a newGlyphVectorobject, performing full layout of the text if possible.static booleantextRequiresLayout(char[] chars, int start, int end) 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 usingdrawString(String,int,int)and other text rendering methods.toString()Converts thisFontobject to aStringrepresentation.Methods declared in class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.protected voidfinalize()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 thisObject.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) 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 voidwait(long timeoutMillis, int nanos) 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
Constructs aFontUIResource.- Parameters:
name- the font namestyle- the style constant for the fontsize- the point size of the font
-
FontUIResource
-