APIdia Launch Partner
Top Description Fields Methods
sun.font

public Interface FontManager

Known Direct Subinterfaces
sun.font.FontManagerForSGE
Imports
java.awt.Font, .FontFormatException, java.io.File

Interface between Java Fonts (java.awt.Font) and the underlying font files/native font resources and the Java and native font scalers.

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public Font2D[]

Returns:

the created Font2D instance
createFont2D
(File
the file holding the font data
fontFile
,
int
the expected font format
fontFormat
,
boolean
whether to retrieve all fonts in the resource or just the first one.
all
,
boolean
true if the file is a copy and needs to be deleted, false otherwise
isCopy
)

Creates a Font2D for the specified font file, that is expected to be in the specified font format (according to the constants in java.awt.Font).

public void
public Font2D
findFont2D(String name, int style, int fallback)

The client supplies a name and a style.

public Font2DHandle

Returns:

the handle for the derived font
getNewComposite
(String
the font family of the derived font
family
,
int
the font style of the derived font
style
,
Font2DHandle
the original font (handle)
handle
)

Creates a derived composite font from the specified font (handle).

public void
preferLocaleFonts()

Indicates a preference for locale-specific fonts in the mapping of logical fonts to physical fonts.

public void
preferProportionalFonts()

preferLocaleFonts() and preferProportionalFonts() are called to inform that the application could be using an alternate set of composite fonts, and so the implementation should try to create a CompositeFonts with this directive in mind.

public boolean

Returns:

true is the font is successfully registered, false otherwise.
registerFont
(Font font)

Register a new font.

Field Detail

LOGICAL_FALLBACKback to summary
public static final int LOGICAL_FALLBACK
NO_FALLBACKback to summary
public static final int NO_FALLBACK
PHYSICAL_FALLBACKback to summary
public static final int PHYSICAL_FALLBACK

Method Detail

createFont2Dback to summary
public Font2D[] createFont2D(File fontFile, int fontFormat, boolean all, boolean isCopy) throws FontFormatException

Creates a Font2D for the specified font file, that is expected to be in the specified font format (according to the constants in java.awt.Font). The parameter isCopy is set to true when the specified font file is actually a copy of the font data and needs to be deleted afterwards. This method is called for the Font.createFont() methods.

Parameters
fontFile:File

the file holding the font data

fontFormat:int

the expected font format

all:boolean

whether to retrieve all fonts in the resource or just the first one.

isCopy:boolean

true if the file is a copy and needs to be deleted, false otherwise

Returns:Font2D[]

the created Font2D instance

deRegisterBadFontback to summary
public void deRegisterBadFont(Font2D font2D)
findFont2Dback to summary
public Font2D findFont2D(String name, int style, int fallback)

The client supplies a name and a style. The name could be a family name, or a full name. A font may exist with the specified style, or it may exist only in some other style. For non-native fonts the scaler may be able to emulate the required style.

getNewCompositeback to summary
public Font2DHandle getNewComposite(String family, int style, Font2DHandle handle)

Creates a derived composite font from the specified font (handle).

Parameters
family:String

the font family of the derived font

style:int

the font style of the derived font

handle:Font2DHandle

the original font (handle)

Returns:Font2DHandle

the handle for the derived font

preferLocaleFontsback to summary
public void preferLocaleFonts()

Indicates a preference for locale-specific fonts in the mapping of logical fonts to physical fonts. Calling this method indicates that font rendering should primarily use fonts specific to the primary writing system (the one indicated by the default encoding and the initial default locale). For example, if the primary writing system is Japanese, then characters should be rendered using a Japanese font if possible, and other fonts should only be used for characters for which the Japanese font doesn't have glyphs.

The actual change in font rendering behavior resulting from a call to this method is implementation dependent; it may have no effect at all, or the requested behavior may already match the default behavior. The behavior may differ between font rendering in lightweight and peered components. Since calling this method requests a different font, clients should expect different metrics, and may need to recalculate window sizes and layout. Therefore this method should be called before user interface initialisation.

Since
1.5
See Also
preferProportionalFonts()
preferProportionalFontsback to summary
public void preferProportionalFonts()

preferLocaleFonts() and preferProportionalFonts() are called to inform that the application could be using an alternate set of composite fonts, and so the implementation should try to create a CompositeFonts with this directive in mind.

See Also
preferLocaleFonts()
registerFontback to summary
public boolean registerFont(Font font)

Register a new font. Please, note that null is not a valid argument, and it's caller's responsibility to ensure that, but to keep compatibility, if null is passed as an argument, false is returned, and no NullPointerException is thrown. As additional note, an implementation should ensure that this font cannot override existing installed fonts.

Returns:boolean

true is the font is successfully registered, false otherwise.